[Gambas-user] Button colors
T Lee Davidson
t.lee.davidson at gmail.com
Mon Mar 4 07:10:37 CET 2019
On 3/3/19 6:11 PM, Pino Zollo wrote:
> HI,
>
> In my project I do dot succeed in changing the Background And Foreground
> colors of Buttons...
>
> neither in the IDE and neither with instructions.
>
> On the contrary I succeed perfectly with Label's and TextLabel's.
>
> I made a small program to show this problem....but now I can not make
> buttons appear....
>
> Here is the small program.
>
> Please some help !
>
> Pino Zollo
The buttons don't appear because you have put them on Form1 which is never opened. FMain is the startup class, and it and it's
form are empty.
Using the IDE's "Run this class" context menu item on Form1 produces, "'Form.Main is incorrectly overridden in class 'Form1'".
Someone will please correct me if I'm wrong, but as far a I know, a graphical Form should not be given a Main() subroutine. That
would be for a non-graphical (ie. command line) application.
Also, you do not need to execute the Button.Show(), Label.Show(), and Me.Show() methods in the Form_Open() event handler. Doing
so is redundant because the Form itself is already being opened (shown), and the button and labels will be shown automatically
with the Form unless set not visible.
I suggest moving the code from the Main() subroutine into the Button2_Click() event handler and then deleting the Main()
skeleton. Then, delete FMain, rename Form1 to FMain and set it as the Startup class. See how that works.
And finally, the color changes work here, both in the IDE and upon execution.
___
Lee
More information about the User
mailing list