need help changing Modal dialog
-
I want to create a Modal Dialog and be in control of it's position in the app. Or even be able to dynamically change it's position. Is this posible? George W Software Developer www.zsystems.ca
-
I want to create a Modal Dialog and be in control of it's position in the app. Or even be able to dynamically change it's position. Is this posible? George W Software Developer www.zsystems.ca
You can do that in two ways, the easy way is to have your dialog call your app and allow your app to determine if it needs to move your dialog. The hard way may be a lot of work, but if this solution does not work, let me know and I will explain the other method. Good Luck
Build a man a fire, and he will be warm for a day
Light a man on fire, and he will be warm for the rest of his life! -
You can do that in two ways, the easy way is to have your dialog call your app and allow your app to determine if it needs to move your dialog. The hard way may be a lot of work, but if this solution does not work, let me know and I will explain the other method. Good Luck
Build a man a fire, and he will be warm for a day
Light a man on fire, and he will be warm for the rest of his life!hi, just wondering, dlg.SetWindowPos() can u jsut call SetWindowPos in response to event - say OnTimer - to adjust the dialog position? i can imagine a situation in which u create a modal/modeless dlg and u wish the dialog to stay within the boundary of its view. in this scenario, do u need to create your own event - for the dialog class? how can u implement this? how can u check that the child dialog is out of place (out-of-predefined boundary) and the fire an even and thru message map i suppose we can handle the situation appropriately?? thanks! norm
-
hi, just wondering, dlg.SetWindowPos() can u jsut call SetWindowPos in response to event - say OnTimer - to adjust the dialog position? i can imagine a situation in which u create a modal/modeless dlg and u wish the dialog to stay within the boundary of its view. in this scenario, do u need to create your own event - for the dialog class? how can u implement this? how can u check that the child dialog is out of place (out-of-predefined boundary) and the fire an even and thru message map i suppose we can handle the situation appropriately?? thanks! norm
I tried SetWindowPos() but it ASSERTS. I was thinking that because I am calling DoModal(), I have lost control of the thing because MFC has taken over. Obviously, any attempts to adjust the position before DoModal() will ASSERT because the dialog window has yet to be created. Any calls after DoModal() is pointless because MFC is in control. I am trying a few different things right now. IGeorgeI :wtf: George W Software Developer www.zsystems.ca
-
I tried SetWindowPos() but it ASSERTS. I was thinking that because I am calling DoModal(), I have lost control of the thing because MFC has taken over. Obviously, any attempts to adjust the position before DoModal() will ASSERT because the dialog window has yet to be created. Any calls after DoModal() is pointless because MFC is in control. I am trying a few different things right now. IGeorgeI :wtf: George W Software Developer www.zsystems.ca
hey there, [QUOTE FROM CODE GURU] u can do that by adding the virtual function pretranslatemessage Eg:- BOOL CUrDlg::PreTranslateMessage(MSG* pMsg) { if((pMsg->message == WM_KEYDOWN) ) { if(GetFocus()->GetSafeHwnd() == GetDlgItem(IDC_UR_EDITCTL_ID)->GetSafeHwnd()) //necessary action } return CDialog::PreTranslateMessage(pMsg); } good luck =) Norman norm