Cannot get CDialogResize to work
-
I'm new to WTL and am using WTL 8.0 with VS 2005. I have created a new modeless dialog based app with AppWizard and then made the relevant modifications to get it to resize, according to Michael Dunn's CP article "Using WTL's Built-in Dialog Resizing Class" http://www.codeproject.com/wtl/wtldlgresize.asp It builds OK, and my dialog gets the gripper size box in the bottom right hand corner, but when I grab it the dialog does not resize. Only the grabber size box itself moves. I've tried comparing to other projects which work, but cannot identify any differences.
-
I'm new to WTL and am using WTL 8.0 with VS 2005. I have created a new modeless dialog based app with AppWizard and then made the relevant modifications to get it to resize, according to Michael Dunn's CP article "Using WTL's Built-in Dialog Resizing Class" http://www.codeproject.com/wtl/wtldlgresize.asp It builds OK, and my dialog gets the gripper size box in the bottom right hand corner, but when I grab it the dialog does not resize. Only the grabber size box itself moves. I've tried comparing to other projects which work, but cannot identify any differences.
I've uploaded a sample VC++ 2005 project demonstrating my problem. Any help on what's wrong would be greatly appreciated. http://www.freefileupload.net/file.php?file=files/030506/1146617037/Test_CDialogResize_Modeless.zip -- modified at 20:52 Tuesday 2nd May, 2006
-
I'm new to WTL and am using WTL 8.0 with VS 2005. I have created a new modeless dialog based app with AppWizard and then made the relevant modifications to get it to resize, according to Michael Dunn's CP article "Using WTL's Built-in Dialog Resizing Class" http://www.codeproject.com/wtl/wtldlgresize.asp It builds OK, and my dialog gets the gripper size box in the bottom right hand corner, but when I grab it the dialog does not resize. Only the grabber size box itself moves. I've tried comparing to other projects which work, but cannot identify any differences.
You forgot the
CHAIN_MSG_MAP(CDialogResize<CMainDlg> )
macro in your window's message map--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
-
You forgot the
CHAIN_MSG_MAP(CDialogResize<CMainDlg> )
macro in your window's message map--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
Hi Mike, Thanks for taking the time to reply. I've already got that macro in "class CMainDlg" in MainDlg.h. Does it need to be defined elsewhere ? Have you managed to successfully compile and run the sample project I uploaded without any changes ?
BEGIN_MSG_MAP(CMainDlg) MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) COMMAND_ID_HANDLER(ID_APP_ABOUT, OnAppAbout) COMMAND_ID_HANDLER(IDOK, OnOK) COMMAND_ID_HANDLER(IDCANCEL, OnCancel) CHAIN_MSG_MAP(CDialogResize<CMainDlg> ) END_MSG_MAP()
-- modified at 21:53 Tuesday 2nd May, 2006 -
Hi Mike, Thanks for taking the time to reply. I've already got that macro in "class CMainDlg" in MainDlg.h. Does it need to be defined elsewhere ? Have you managed to successfully compile and run the sample project I uploaded without any changes ?
BEGIN_MSG_MAP(CMainDlg) MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) COMMAND_ID_HANDLER(ID_APP_ABOUT, OnAppAbout) COMMAND_ID_HANDLER(IDOK, OnOK) COMMAND_ID_HANDLER(IDCANCEL, OnCancel) CHAIN_MSG_MAP(CDialogResize<CMainDlg> ) END_MSG_MAP()
-- modified at 21:53 Tuesday 2nd May, 2006Go to resource view and change the border of IDD_MAINDLG to Resizing.
-
I'm new to WTL and am using WTL 8.0 with VS 2005. I have created a new modeless dialog based app with AppWizard and then made the relevant modifications to get it to resize, according to Michael Dunn's CP article "Using WTL's Built-in Dialog Resizing Class" http://www.codeproject.com/wtl/wtldlgresize.asp It builds OK, and my dialog gets the gripper size box in the bottom right hand corner, but when I grab it the dialog does not resize. Only the grabber size box itself moves. I've tried comparing to other projects which work, but cannot identify any differences.
After investigating, I see that there was a breaking change from WTL 7.0 to 7.1. The third param to
CDialogResize::DlgResize_Init()
is styles to add to the window. This changed fromWS_THICKFRAME|WS_CLIPCHILDREN
to justWS_CLIPCHILDREN
. As the other post said, the best way is to set the dialog's border to Resizing in the resource editor. (Not doing that, even in WTL 7.0, creates a positioning glitch in XP with themes turned on.)--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
-
Go to resource view and change the border of IDD_MAINDLG to Resizing.
Thanks hfry! It's working now. You've saved me from insanity! :)
-
After investigating, I see that there was a breaking change from WTL 7.0 to 7.1. The third param to
CDialogResize::DlgResize_Init()
is styles to add to the window. This changed fromWS_THICKFRAME|WS_CLIPCHILDREN
to justWS_CLIPCHILDREN
. As the other post said, the best way is to set the dialog's border to Resizing in the resource editor. (Not doing that, even in WTL 7.0, creates a positioning glitch in XP with themes turned on.)--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
Thanks for taking the time to look into it Mike, and for providing an explanation of why it wasn't working. I have now done what hfry suggested and all is working fine now :) It's not important for me now, but I'm sure anyone else who delves into CDialogResize would appreciate it if you updated both your WTL articles which mention CDialogResize to include this snippet of info. 1) Resizing Dialogs section of WTL for MFC Programmers, Part V - Advanced Dialog UI Classes 2) Using WTL's Built-in Dialog Resizing Class Thanks again for your help. I can now continue development of my world beating, super efficient resizable About dialog :-D
-
Go to resource view and change the border of IDD_MAINDLG to Resizing.
Thank you! I have tried several times over the last 15 years to get this to work and today I know why!
-
Go to resource view and change the border of IDD_MAINDLG to Resizing.
Thank you! I have tried several times over the last 15 years to get this to work and today I know why!