[Gambas-user] - Populating a Combobox from a DB

Caveat Gambas at ...1950...
Fri Aug 1 17:53:38 CEST 2008


I believe you need to use Object.Attach()

If you create the control via the GUI, it's automatically attached to
the Form, but when you create the control yourself, you need to tell the
Form that you want to capture events from the object.

Example:

PUBLIC SUB Form_Open()
  DIM hComboBox AS ComboBox
  hComboBox = NEW ComboBox(ME)
  hComboBox.Add("Selection 1")
  hComboBox.Add("Selection 2")
  Object.Attach(hComboBox, ME, "hCombo")
END

PUBLIC SUB hCombo_Click()
  
  Message("You clicked, milord?")
  
END


On Sat, 2008-08-02 at 00:46 +1000, John K wrote:
> Re my earlier e-mail I've solved the problem by repopulating the 
> combobox at the end of the Button_Click() subroutine.
> However I have another question. If I create a combobox with:
> DIM hComboBox AS ComboBox
> hComboBox = NEW ComboBox ( Frame1 )
> 
> it doesn't accept any events ie hComboBox_Change()
> 
> but if I create a comboBox by using the toolbox it will. Why is this or 
> am I doing something stupid (again!) and missing something simple?
> 
> Thanks...............
> John
> 
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user





More information about the User mailing list