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

Benoit Minisini benoit.minisini at gambas-basic.org
Fri Mar 24 16:30:00 CET 2023


Le 24/03/2023 à 16:22, Claus Dietrich a écrit :
> 
> If this doesn't fit to a user control which shall receive the focus,
> 
> what would be the right way?
> 
> Best regards
> 
> Claus
> 

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,

-- 
Benoît Minisini.



More information about the User mailing list