[Gambas-user] custom controls tutorial or guide

Fabien Bodard gambas.fr at ...626...
Sun Nov 8 10:07:00 CET 2009


I think for the begginnig you must to do an encapsulating classe.

It's a class that take a control as parameter. And give to it new
function or feature.

so:

=============================================================

CLASS CColourCombo

Private $hComboBox
Private $hObs as new Observer
Public sub _New(hCombo as ComboBox)

  $hComboBox = hCombo
  $hOBS=NEW Observer(hCombo) AS "MyCombo"
End


PUBLIC SUB MyCombo_Change()

  If $hCombox.Current.Text<0 then
    $hComboBox.BackColor=Color.Red
  else
    $hComboBox.BackColor=Color.White
  endif
end
====================================
'Form

Now in your form just add
Public sub _New
dim hCColourCombo as CColourCombo

hCColourCombo = new CColourCombo(MyComboBox)

endif


END

======================================



And now you have a combo box that change backcolour when the selected
value is negative !

It's more simple than a control if you have no so many feature to add.


Fabien



2009/11/8 bbb888 <bbruen at ...2308...>:
>
> Hi guys,
>
> Is there a guideline of some sort for howto create custom controls?
>
> I was thinking I might cut my teeth on a context sensitive combobox that
> changes background color depending on the selected value.
>
> But I just don't know where to start. :-((
>
> regards
> bruce
> --
> View this message in context: http://old.nabble.com/custom-controls-tutorial-or-guide-tp26251482p26251482.html
> Sent from the gambas-user mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> 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