[Gambas-user] Custom controls
Benoît Minisini
gambas at ...1...
Sun Jan 17 22:03:19 CET 2010
> Hi all,
> I'm just learning Gambas and trying to do something simple (I thought)
> by making custom versions of controls.
>
> For example, I want to inherit the Label and TextBox controls to add
> some new properties and methods.
> As a basic example, in my program the labels for mandatory fields are a
> different font/colour to the non-mandatory field labels. To achieve this
> (in wxPython) I have simply inherited the Label control and added a new
> variable 'isMandatory' to pass to the constructor which is then used to
> determine the font/colour of the label.
>
> I've searched everywhere trying to find out how to do this and come up
> with very little on how to do this. Can anyone point me in the right
> direction please?
>
> Also, once I have created custom controls (one step at a time, i
> know...), can I get them into the Gambas GUI toolbox so I can drag them
> onto forms etc. or do I need to add them to their parents programatically?
>
> thanks
> Aaron
>
For example, you have to:
1) Create a class named "MyLabel" in your project.
2) Use "INHERITS Label".
But you have to use it manually, and you won't see it in the IDE toolbox.
If you want that, you have to create a component, as explained in the link
provide by nospam x 3.
Regards,
--
Benoît Minisini
More information about the User
mailing list