Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » Help needed to set the focus
Re: Help needed to set the focus [message #21139 is a reply to message #21137] Tue, 05 May 2009 00:02 Go to previous message
mirek is currently offline  mirek
Messages: 14267
Registered: November 2005
Ultimate Member
JoseB wrote on Mon, 04 May 2009 15:38

Hi all,

I have an application which have a menu that each menu option opens a modal dialog.
On the MainApp class file I declare a dialog in this way:

header:
WithSettingsDlgLayout<TopWindow> m_dlgSettings;

cpp:
void MyApp::OnMenuOptionSettings(void)
{
ActiveFocus(m_dlgSettings.edLang);
m_dlgSettings.edLang.SetFocus();

m_dlgSettings.ok<<= THISBACK(OnSettingsOK);
m_dlgSettings.cancel<<= THISBACK(OnSettingsCancel);

m_dlgSettings.Execute();
}

Well, for the first time that the dialog is opened, focus is on the edLang edit box, but if the focus is in other edit box
when closing the dialog, on the next time the dialog is open the focus is on that edit box and not on the edLang, even executing the
code of OnMenuOptionSettings(void).
It seems that the dialog (m_dlgSettings) saves state.



Yes.

Quote:


Do I have to clear the state when closing the dialog?



Better before opening.

Quote:


How to hanlde this?
Should i use ActiveFocus or SetFocus.

I tried to put

ActiveFocus(m_dlgSettings.edLang);
m_dlgSettings.edLang.SetFocus();



m_dlgSettings.ActiveFocus(m_dlgSettings.edLang);

Smile

ActiveFocus is "focus for TopWindow when it is active". It is member function of TopWindow.

Mirek
 
Read Message
Read Message
Previous Topic: Formating date according to the country
Next Topic: Popup input Dialog
Goto Forum:
  


Current Time: Sat Aug 02 15:27:55 CEST 2025

Total time taken to generate the page: 0.08696 seconds