[wxMac] Cant set the focus on wxComboBox child of a modeless dialog

[wxMac] Cant set the focus on wxComboBox child of a modeless dialog

Post by Eran Ifra » Mon, 15 Sep 2008 20:57:27


i list, Platform: OSX 10.5.2
gcc: 4.0.1
WX: 2.8.7

In my application I have a modeless dialog (very much like the standard
Find/Replace dialog)

When user launches it on the first time (say, he hits Ctrl-F), non of its
child controls has focus - although I am calling m_findString->SetFocus()
followed m_findString->setSelecion(-1, -1) inside the 'Show()' method which
I overrided:

// m_findString is of type: wxComboBox

bool FindInFilesDialog::Show()
{
if( IsShown() )
return true;

bool res = wxDialog::Show();
SetData(m_data);
m_findString->SetSelection(-1, -1); // select all
m_findString->SetFocus();
return res;
}

The same code works as expected on Linux/Win

Any advise?

--
Eran Ifrah
Cross Platform C++ IDE: http://www.codelite.org

<div dir="ltr"><font size="3">Hi list, </font><div><span class="Apple-style-span" style="font-size: 16px;">Platform: OSX 10.5.2</span></div><div><span class="Apple-style-span" style="font-size: 16px;">gcc: 4.0.1</span></div>
<div><span class="Apple-style-span" style="font-size: 16px;">WX:   2.8.7</span></div><div><span class="Apple-style-span" style="font-size: 16px;"><br></span></div><div><span class="Apple-style-span" style="font-size: 16px;">In my application I have a modeless dialog (very much like the standard Find/Replace dialog)</span></div>
<div><span class="Apple-style-span" style="font-size: 16px;"><br></span></div><div><font size="3">When user launches it on the first time (say, he hits Ctrl-F), non of its child controls has focus - although I am calling m_findString->SetFocus() followed m_findString->setSelecion(-1, -1) inside the 'Show()' method which I overrided:</font></div>
<div><span class="Apple-style-span" style="font-size: 16px;"><br></span></div><div><span class="Apple-style-span" style="font-size: 16px;">// m_findString is of type: <span class="Apple-style-span" style="border-collapse: collapse; font-size: 13px; white-space: pre; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; ">wxComboBox</span></span></div>
<div><span class="Apple-style-span" style="border-collapse: collapse; white-space: pre; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px;"><br></span></div><div><span class="Apple-style-span" style="font-size: 16px;"><div>
bool FindInFilesDialog::Show()</div><div>{</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>if( IsShown() )</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>return true;</div><div>
<br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>bool res = wxDialog::Show();</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>SetData(m_data);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>m_findString->SetSelection(-1, -1); // select all</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>m_findString->SetFocus();</div&
 
 
 

1. Child Modeless Dialogs Always Hide Parent Modeless Dialog

2. MDI app: Can't get window focus of modeless child dialog window

Hey again,

Ok - so I'm designing an application which uses a MDI without MFC, but this
ain't no vanilla MDI - it's actually a single document application which
uses many dialog boxes as child windows inside the MDI frame. So normal
tutorials/rules don't seem to apply here.

I init my frame, client and one of the dialog boxes in the app just fine -
but this dialog window (which is a child of the client) has its title bar
greyed out, like it doesn't have the focus. I can still move the dialog
around the screen - but no mouse clicks seem to do anything to *some* of the
contents - I have an edit control and a few buttons in there. I can't edit
the contents of the edit control by setting focus via mouse click; I can
click one of the buttons, and then tab over to the edit control, then it
works - but no mouse clicks seem to activate the focus.

If I set the "Control" property (under misc) of my dialog box all of sudden
things work as they should, but my dialog box loses my title bar and I can't
drag the thing anywhere. So that's no good.

My proc's have nothing special in them - the frame proc has a WM_CREATE for
the client window, and returns to DefFrameProc, and my dialog box has a
standard DialogProc, returning false.

This is driving me crazy, and the help isn't revealing any info - does
anyone have any ideas? I don't think I need any special WM_ messages in my
frame proc, 'cause standard MDI examples work just fine..

Thanks in advance,
Aienthiwan

3. Cannot Set Focus to Modeless Dialog w/ DesktopParent

4. how to set focus back to IE, after popup modeless dialog closes?

5. Tabbing in modeless dialog that is a child of a modal dialog

6. How to show a modeless dialog as a child window in another dialog.

7. focus on modeless dialog

8. a top-most modeless dialog that i create grabs focus, how to avoid?

9. Modeless Dialog Boxes - Knowing when it terminates, Terminate without using delete Dlg and Getting input Focus

10. modeless dialog focus problem

11. tab key, Win32, input focus and modeless dialog

12. Modeless Child Dialog Minimize Behavior

13. Modeless dialog with Child style

14. Modeless Child Dialog

15. how to: bring main form to front, when its modeless dialog comes into focus?