[Gambas-user] ComboBox UserContol, with pictures.

Sam Dadds sammy_dadds at ...43...
Sun Nov 16 18:57:43 CET 2014


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.



More information about the User mailing list