Re: ListItem how to create ?
My guess is that the ListItem keeps a private reference to it's Parent object, and that there isn't really an exposed way to VB to set the Parent reference. This could be why it won't allow you to create a 'parentless' ListItem. One thing to try that pops into my head is to create a mirror object that implements the ListItem interface and then pass it back and forth using iDispatch?
Of course, you've already mentioned the easiest solution--using a hidden ListView to generate your objects.
Re: ListItem how to create ?
If you check, there are not many objects allowed to go after a 'New' statement.
Also, the ListItem is more or less from a dynamic size since one of its properties is the list of subitems not yet specified. Maybe the creation process for a new listitem is thus inherent in the ListView control and not available without it.
Re: ListItem how to create ?
Quote:
Originally Posted by Comintern
My guess is that the ListItem keeps a private reference to it's Parent object, and that there isn't really an exposed way to VB to set the Parent reference. This could be why it won't allow you to create a 'parentless' ListItem. One thing to try that pops into my head is to create a mirror object that implements the ListItem interface and then pass it back and forth using iDispatch?
Of course, you've already mentioned the easiest solution--using a hidden ListView to generate your objects.
In that way Ireally should have done it as I wanted it to do before. As a control from a listView Control in C++. But my grid is already done ( its a grid which allows having a button, a combobox, a checkbox and a colored field and as much editable columns as you want in each row, so you can do every different combinations of this ( but only one of each sort of special fields. So I'm using it for examlple only with the button and the editfields and in onother part of my program I have a combination of a checkbox a combobox, a colorfield and some editfileds but no button.
So this is nearly ready now, but in drag and drop in dataexchange with a listview I have now my own class for dataexchange and on the other side the listview with listitem. Easy to handle but some code, for the exchange has now to be a bit more instead of only handling the listItemobject from the one to the other . OK the next axctiveX I'll do in C++ for I' dreaming from a control, which free decision of how many buttons, editable fields,noneditable fields, comboboxes , pictures.. checkboxes it would have. But this then I think I'll di in C++ as a training :D this winter. ( when the nights are cold and you can better think then in this heat. ) But I think I'll give the idea a short try to use a hidden listbox as a ListItemfactiory. Hopefully the activeX will not slow down too much by this lot of code in the background or that other troubles occure when I try to use the activeX in the compiled version.
We will see.