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

Bruce Steers bsteers4 at gmail.com
Fri Mar 24 23:56:23 CET 2023


On Fri, 24 Mar 2023 at 21:21, Claus Dietrich <claus.dietrich at freenet.de>
wrote:

> 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
>

Also check out gb.form and gb.gui.base source, there are many custom
UserControls in there you can use as examples.

"some open questions"  lol , probably a million questions, I know I did.
Mostly the answers you need can be found by examining similar ready made
controls.

Hmmm, As for PictureBox cannot have focus the wiki says otherwise. (not
that i dissagree with Ben)
https://gambaswiki.org/wiki/comp/gb.qt4/picturebox shows it has .HasFocus
.SetFocus _GotFocus() , _LostFocus()

okay i did some tests..
pressing tab in gui does not give it focus.

Using PictureBox1.SetFocus() "does" give it focus. (not visibly but the
GotFocus event triggers.
It seems a picturebox cannot get focus but it should as all the focus
related properties and events of UserControl are there.

Seems a bit misleading. Is there a way to hide the focus related parts of
picturebox on the wiki?

BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230324/16ff12e5/attachment.htm>


More information about the User mailing list