I am new to wxWidgets, but have been using C++Builder since it was first released by Borland. I want to be able to use Linux so have jumped ship.
I'm trying to create a custom control which accepts focus on tab / shift tab, and can be created dynamically (screen layout loaded from file at run time).
I have tried deriving from wxWindow and wxControl and neither seem to accept focus.
Having tried placing normal buttons on the window at design time, it appears Tab does nothing unless the buttons are placed on a wxPanel.
Unfortunately, as soon at a wxPanel is placed on the form, even if it's just a tiny square in one corner, the custom controls fail to appear at all.
If all else fails, I presume I just capture the tab key in the main window event handling and do it the hard way. Not a huge problem as I only have one form, however it would be nice to be able to do it natively.
Any suggestions would be gratefully received.
TabStop on custom control
Re: TabStop on custom control
By "window" there you probably mean wxFrame or wxDialog.
Either way, just place a wxPanel on whatever "window" you are using, then place the buttons on the wxPanel.
Re: TabStop on custom control
Hi,
Change the parent window to be wxPanel, and everything will show up.
Thank you.
If it fails to appear, it means you gave it a wrong parent.ChrisBear wrote: ↑Mon Nov 11, 2019 11:41 pm I am new to wxWidgets, but have been using C++Builder since it was first released by Borland. I want to be able to use Linux so have jumped ship.
I'm trying to create a custom control which accepts focus on tab / shift tab, and can be created dynamically (screen layout loaded from file at run time).
I have tried deriving from wxWindow and wxControl and neither seem to accept focus.
Having tried placing normal buttons on the window at design time, it appears Tab does nothing unless the buttons are placed on a wxPanel.
Unfortunately, as soon at a wxPanel is placed on the form, even if it's just a tiny square in one corner, the custom controls fail to appear at all.
Change the parent window to be wxPanel, and everything will show up.
Thank you.
Re: TabStop on custom control
I tried placing the panel in the whole frame, and then using that as parent. I also tried placing a tiny panel in the corner and leaving the parent set as the frame. In both cases, the controls failed to appear. With the panel deleted (and parent set to frame) the controls appeared.ONEEYEMAN wrote: ↑Tue Nov 12, 2019 3:13 pm Hi,If it fails to appear, it means you gave it a wrong parent.ChrisBear wrote: ↑Mon Nov 11, 2019 11:41 pm I am new to wxWidgets, but have been using C++Builder since it was first released by Borland. I want to be able to use Linux so have jumped ship.
I'm trying to create a custom control which accepts focus on tab / shift tab, and can be created dynamically (screen layout loaded from file at run time).
I have tried deriving from wxWindow and wxControl and neither seem to accept focus.
Having tried placing normal buttons on the window at design time, it appears Tab does nothing unless the buttons are placed on a wxPanel.
Unfortunately, as soon at a wxPanel is placed on the form, even if it's just a tiny square in one corner, the custom controls fail to appear at all.
Change the parent window to be wxPanel, and everything will show up.
Thank you.
Would placing a panel in a frame take over paint events from the frame ? It has occurred to me that another custom control which is repainted from a timer (live video window) is still there.
Re: TabStop on custom control
I think we need to see some code now. It's hard to tell what you're doing wrong just by hearing the description of what (you think) you did.I tried placing the panel in the whole frame, and then using that as parent. I also tried placing a tiny panel in the corner and leaving the parent set as the frame. In both cases, the controls failed to appear.
No. But if you draw something in the paint event of the frame, and the frame is covered with a wxPanel, whatever you drew on the frame will not be visible.Would placing a panel in a frame take over paint events from the frame ?
Use the source, Luke!