OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: Fred Tomke on March 15, 2009, 03:05:33 PM

Title: ItemData
Post by: Fred Tomke on March 15, 2009, 03:05:33 PM
Hello,

I'm using the possibility of optional ItemData in comboboxes, listboxes, listviews and grids for assigning the item to a recordset in a database using the unique key. This is very interesting if the control has to show sorted items which are unsorted in the list in the AutoLISP program. Using the unique key the item can be identified very quick. For this idea I created a sample to use ItemData but I got some interesting detail I don't know whether tey're bugs or not. I attached the sample.

My questions are:
ComboBox, Sorted=True:

ImageComboBox, Sorted=True:

ListBox, Sorted=True:

GridBox, Sorted=True:

Fred
Title: Re: ItemData
Post by: owenwengerd on March 15, 2009, 05:10:59 PM
These are definitely bugs. I'll need to think about a better strategy for dealing with this problem. My current design is obviously flawed.

While looking at Control\ComboBox.htm I noticed that it lists some incorrect methods. GetItem and SetItem should not be listed, and AddColor, AddList, AddPath, GetDir, and InsertString should be added. I will do that now and upload the revised file so you can see what I changed.
Title: Re: ItemData
Post by: owenwengerd on March 15, 2009, 08:45:07 PM
It turns out that sorted image combo boxes are not possible (at least not with the built-in Windows control). Therefore, I have removed the Sorted property from Image Combo Box (note that I already changed the DEU help files).

The List Box and Combo Box should now be working correctly when setting and querying item data, including setting both at design-time. This should now work even when the list is sorted. The only exception is for combo box styles that automatically populate themselves; those styles of combo boxes ignore the List and ItemData properties.

I fixed the Grid bug that caused your cell images to get confused when the grid is sorted.

To fix the problem with the list box and combo box controls, I had to change the way the List and Item Data properties are managed internally. One nice benefit of the change is that those properties now get automatically updated whenever there is any change in the list, even changes that are not caused by your code. Although I didn't test it, this should also mean that (dcl_Control_GetList) after a (dcl_ListBox_Dir) will return the new list of files.
Title: Re: ItemData
Post by: Fred Tomke on March 16, 2009, 12:16:59 AM
Thank you very much, Owen.
Could this be an interesting sample for OpenDCL sample which demonstrates how to work with ItemData? I would improve it a bit and publish then?

Fred