[Gambas-user] ComboBox UserContol, with pictures.

Charlie Reinl Karl.Reinl at ...2345...
Mon Nov 17 21:36:14 CET 2014


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. 

-- 
Amicalement
Charlie





More information about the User mailing list