wx 3.1 Cocoa: wxTextCtrl focus

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
heinermueller
Experienced Solver
Experienced Solver
Posts: 99
Joined: Sat Oct 26, 2013 11:54 am

wx 3.1 Cocoa: wxTextCtrl focus

Post by heinermueller »

Hi All,

in my application a have a dialog with a multiline wxTextCtrl. When i open the dialog using ShowModal(), i cannot focus the text control with the mouse. Setting the focus via 'tabbing' and programmatical via 'SetFocus()' works. Any solution to this?

Best regards,
Heiner
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: wx 3.1 Cocoa: wxTextCtrl focus

Post by PB »

This happened to me once on MSW. I found out that I created that control with a wrong parent. Not saying it's necessarily your case...
heinermueller
Experienced Solver
Experienced Solver
Posts: 99
Joined: Sat Oct 26, 2013 11:54 am

Re: wx 3.1 Cocoa: wxTextCtrl focus

Post by heinermueller »

The control is created like this, generated by wxglade:

Code: Select all

text_ctrl = new wxTextCtrl(panelXY, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxTE_MULTILINE|wxTE_PROCESS_ENTER|wxTE_PROCESS_TAB);
should i (re-) set a parent later?
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: wx 3.1 Cocoa: wxTextCtrl focus

Post by PB »

heinermueller wrote:The control is created like this, generated by wxglade:

Code: Select all

text_ctrl = new wxTextCtrl(panelXY, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxTE_MULTILINE|wxTE_PROCESS_ENTER|wxTE_PROCESS_TAB);
should i (re-) set a parent later?
I think you're good, assuming panelXY is a child of the dialog and it is added to the appropriate sizer. Nevertheless, there must be something wrong with your dialog design/layout/whatever. Difficult to tell without seeing the actual code. BTW, can you try the code on MSW or Linux?
heinermueller
Experienced Solver
Experienced Solver
Posts: 99
Joined: Sat Oct 26, 2013 11:54 am

Re: wx 3.1 Cocoa: wxTextCtrl focus

Post by heinermueller »

On MSW it works fine.
Nevertheless, there must be something wrong with your dialog design/layout/whatever.
Control creation, sizer assignment and dialog layout is made by wxglade. There are no actions (Enable/Focus etc) with that control. If the control is visible - what could go wrong in that case? Wrong order of creation? Missing/Duplicate ID or similar?
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wx 3.1 Cocoa: wxTextCtrl focus

Post by doublemax »

Is this your first OSX application with wxWidgets? Could it be that it's this problem?
http://www.wxwidgets.org/docs/faq/osx/#nofocus
Use the source, Luke!
heinermueller
Experienced Solver
Experienced Solver
Posts: 99
Joined: Sat Oct 26, 2013 11:54 am

Re: wx 3.1 Cocoa: wxTextCtrl focus

Post by heinermueller »

No, i found this FAQ on the web, too, but this is not the case. The application is an app bundle, it is running fine. I noticed, the wxTextCtrl has the same focus problem in another application dialog. There i can troubleshoot this with a programmatical 'SetFocus', but in this case here i would like to avoid that because it would confuse users.
heinermueller
Experienced Solver
Experienced Solver
Posts: 99
Joined: Sat Oct 26, 2013 11:54 am

Re: wx 3.1 Cocoa: wxTextCtrl focus

Post by heinermueller »

I am using a wxRichTextCtrl and it works perfectly now. Should i file a bug report?
Post Reply