[Gambas-user] How can a self made Button UserControl receive the Focus?

Claus Dietrich claus.dietrich at freenet.de
Fri Mar 24 22:20:01 CET 2023


Dear Gianluigi

Many thanks for the project. These square buttons also don't receive the 
focus

but this can be resolved by setting the focus-property to True. However, 
the

square buttons are not prepared to display a focus.


Dear Lee

I had no issue at all to load the program and it behaves as expected.


Dear Benoít

Thanks for the valuable hints. The focus-reception works already. I still

need to learn, what the Style-Class can provide and I have to read the

recommended switch button documentation because there are still

some open questions about self made user controls.

Best regards

Claus


Am 24.03.23 um 14:41 schrieb Gianluigi:
> sorry I forgot the GotFocus and LostFocus methods
>
> Hi Benoit,
>
> if I remember correctly this once worked, see attached
>
> Regards
>
> Gianluigi


Am 24.03.23 um 20:21 schrieb T Lee Davidson:
> I can't get that project to load up in the IDE properly. 


Am 24.03.23 um 16:30 schrieb Benoit Minisini:
>
> A PictureBox is a display-only control, it can't have the focus.
>
> You should use instead a DrawingArea, which has a Focus property to 
> tell if your control can get focus or not.
>
> The drawing is then done through the the DrawingArea Draw event handler.
>
> The Style.StateOf() method will tell you the state of your UserControl.
>
> Look at the documentation and at the source code of the SwitchButton 
> control (for example) in the 'gb.form' component for more details.
>
> Regards, 




More information about the User mailing list