View previous topic :: View next topic |
Author |
Message |
baxissimo
Joined: 23 Oct 2006 Posts: 241 Location: Tokyo, Japan
|
Posted: Fri Nov 16, 2007 12:58 am Post subject: Focus question |
|
|
If I have just a GLControl in a form it gets key events.
If I add a button to the form, now I don't get key events and the button just seems to hold on to the focus no matter what I do.
How can I make it so that I can have a button (and other controls) on the form but either the form or the GLControl can still get key events?
Can I make the button not focusable?
Or can I make it somehow so that the ESC key always unfocuses everything no matter what has focus?
Thanks. |
|
Back to top |
|
|
Chris Miller
Joined: 27 Mar 2004 Posts: 514 Location: The Internet
|
Posted: Fri Nov 16, 2007 4:33 pm Post subject: Re: Focus question |
|
|
Try giving the GLControl the selectable control style using setStyle; and to allow it to be tabbed-to, set the property tabStop. |
|
Back to top |
|
|
baxissimo
Joined: 23 Oct 2006 Posts: 241 Location: Tokyo, Japan
|
Posted: Sat Nov 17, 2007 12:10 am Post subject: Re: Focus question |
|
|
Chris Miller wrote: | Try giving the GLControl the selectable control style using setStyle; and to allow it to be tabbed-to, set the property tabStop. |
Tried the tabStop thing and it seemed to work for letting it get the focus.
Not sure how to use the setStyle thing. Can I just say "setStyle(SELECTABLE)" in the constructor of my control? Don't I need to OR that together with whatever the default flags are (like setStyle(SELECTABLE|getStyle()) ? |
|
Back to top |
|
|
Chris Miller
Joined: 27 Mar 2004 Posts: 514 Location: The Internet
|
Posted: Mon Nov 19, 2007 9:53 am Post subject: Re: Focus question |
|
|
baxissimo wrote: | Not sure how to use the setStyle thing. Can I just say "setStyle(SELECTABLE)" in the constructor of my control? Don't I need to OR that together with whatever the default flags are (like setStyle(SELECTABLE|getStyle()) ? |
setStyle only touches the flags you specify; the bool next parameter decides if they are set or unset. All other style flags are preserved. |
|
Back to top |
|
|
baxissimo
Joined: 23 Oct 2006 Posts: 241 Location: Tokyo, Japan
|
Posted: Mon Nov 19, 2007 10:15 am Post subject: Re: Focus question |
|
|
Chris Miller wrote: | baxissimo wrote: | Not sure how to use the setStyle thing. Can I just say "setStyle(SELECTABLE)" in the constructor of my control? Don't I need to OR that together with whatever the default flags are (like setStyle(SELECTABLE|getStyle()) ? |
setStyle only touches the flags you specify; the bool next parameter decides if they are set or unset. All other style flags are preserved. |
Ah, ok. I see now. Well SELECTABLE was not listed in the doc as being a currently supported style, so I changed it. Hopefully you corrected the doc I added if it was wrong. |
|
Back to top |
|
|
|