[Gambas-user] Help creating user control

Benoît Minisini gambas at ...1...
Mon Jun 22 13:45:44 CEST 2009


> I read how to create user control from this link
> http://www.gambasdoc.org/help/dev/gambas
>
> but I still having some problem to get it work .
> I want to create a custom control button .
> - FButtonEX (form)
> - ButtonEX (class)
>
> on the form (FButtonEX) , I drag and drop a button .
>
> -----------------------------------------------
> on source FButtonEx.class
>
> public sub _new(optional bFile as boolean)
> end sub
>
>
> ----------------------------------------------
> on source ButtonEx.class
>
> INHERITS userControl
> export
>
> private frmButton as FButtonEx
>
> public sub _new()
>   frmButton = new FButtonEx(false, me) as "frmButton"
>   object.attach(frmButton, me, "frmButton")
> end sub
>
> ------------------------------------------------------
> I also put buttonex.png in the control folder
>
> in project property I make sure on option tabs  "this project is component
> is YES and on provide tabs ButtonEX type=control group=dialog
>
>
> compile and make .
>
>
> I create another project and on toolkits dialog tabs, anew icon show up
> call buttonex . I click and drag it into the form . what it show only a
> rectangle with nothing in it . a button that suppose to be there not show
> up . but when I run this project the button show up .
>
>
> so how do i make the button show up on the ide ?
>
> if I missing anything please let me know . the wiki how-to help not very
> helpful . this is my first time try to create custom user control .

1) The IDE cannot draw controls outside of gb.gui, gb.form and gb.form.mdi. 
Instead it draws a frame with the control icon and the icon name - Like what 
is done with the DrawingArea control.

2) If you don't see that, then there is a bug in your component. Please 
provide your source code, and I will tell you what is wrong.

Regards,

-- 
Benoît




More information about the User mailing list