[Gambas-user] ComboBox UserContol, with pictures.

Jørn Erik Mørne epost at ...3323...
Mon Nov 17 22:30:58 CET 2014


Den 17. nov. 2014 21:36, skrev Charlie Reinl:
> Am Sonntag, den 16.11.2014, 17:57 +0000 schrieb Sam Dadds:
>> Hi All,
>>
>> Need help with a custom ComboBox.
>>
>>    I've created a UserControl (extends UserControl) with the normal stuff
>> (TextBox for selection, picture for selected item and picture for dropdown button).
>>
>>    The actual drop down list is a ListView instead of a ListBox for item pictures.
>> This all works well.
>>
>>    Problem is with positioning the drop down list.  The ListView actually gets re-parented
>> to the underlying form so it will display normally even when the ComboBox is inside a
>> toolbar or other container.
>>
>>    Finding the correct X and Y is a problem. Depending on how many containers the actual
>> ComboBox is inside the X and Y become difficult to calculate.
>>
>>    It seems the borders or margin padding of the additional containers are not taken into consideration when reporting the X and Y of the ComboBox container.
>>
>>    Currently I've tried iterating up the containers via the parent of the ComboBox and
>> add up the left or X properties until the actual parent form is found.  This is close
>> but not 100% accurate.  By adding in the Desktop.Scale it gets a bit closer but still
>> off.
>>
>>    I've looked at the source for the db version of a ComboBox but the internal ListBox
>> is actually used.
>>
>>    Does anyone have an example of this or a better idea of how to use a ListView as the
>> List container of the ComboBox?
>>
>>    It's not critical but it would be nice to have item pictures in a ListBox or ComboBox.
>>
>> Thanks.
> Salut Sam,
>
> have a look at Christof Thalhofer's "Gambas Combobox for Lists and
> Databases", https://github.com/Deganius/DegComboBox , may be you find
> some ideas.
>
Perhaps I haven't understood your issue, but why not set the 
ListView.Ignore = True and the parent to the current form?




More information about the User mailing list