Query abt dialog box
-
But how can i do this? is there any function for this?? Thanks for reply.
sruti_p wrote:
But how can i do this? is there any function for this??
It should be easy to find one. Hey CP has one for sure I think I saw one. :~ Of course WhiteSky has mentioned two. But they work on a single control. But the above mentioned technique can take a bunch of controls and resize them as your specify. I think I saw one or two or three... of those layout managers in Code Project. Please check.
Nibu thomas A Developer Programming tips[^] My site[^]
-
There is no need to design a layout manager. You just have to resize the dialog box controls as follows. 1. Get the Client rectangle of the Dialog Box. ( Use: GetClientRect(LPRECT)) 2. Calculate the new size of controls. 4. Validate whether the dialog controls are valid window ( Use; IsWindow( HWND )) 5. Move dialog controls to the new position i they are valid windows. Hope it is useful Thank You Regards, Benoy Bose
I Even want to increase/decrease the size of the controls based on th ewindow size. How can i do this?? :((
-
sruti_p wrote:
But how can i do this? is there any function for this??
It should be easy to find one. Hey CP has one for sure I think I saw one. :~ Of course WhiteSky has mentioned two. But they work on a single control. But the above mentioned technique can take a bunch of controls and resize them as your specify. I think I saw one or two or three... of those layout managers in Code Project. Please check.
Nibu thomas A Developer Programming tips[^] My site[^]
Thanks for ur reply.:)
-
I Even want to increase/decrease the size of the controls based on th ewindow size. How can i do this?? :((
You can either use Layout Managers or simple use MoveWindow or SetWindowPos in OnSize( WM_SIZE )
-
I Even want to increase/decrease the size of the controls based on th ewindow size. How can i do this?? :((
sruti_p wrote:
I Even want to increase/decrease the size of the controls based on th ewindow size. How can i do this??
Layout Managers Found In CP[^]. You should try to search first. :|
Nibu thomas A Developer Programming tips[^] My site[^]
-
you can use WM_SIZE and use functions MoveWindow or SetWindowPos in this event_**
**_
whitesky
I am not getting it. This is what my code is: void CEgAppDlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); // TODO: Add your message handler code here CRect wRect,eRect; GetClientRect(wRect); m_edit.GetClientRect(eRect); POINT * pt; pt->x=eRect.left; pt->y=eRect.top; ::ClientToScreen(m_edit.m_hWnd,pt); eRect.bottom+=30; eRect.right+=30; ::MoveWindow(m_edit.m_hWnd,pt->x,pt->y,eRect.Width(), eRect.Height(),TRUE); } I am getting an Exception:((
-
sruti_p wrote:
I Even want to increase/decrease the size of the controls based on th ewindow size. How can i do this??
Layout Managers Found In CP[^]. You should try to search first. :|
Nibu thomas A Developer Programming tips[^] My site[^]
Thanks a lot. I got it.:)
-
How can i resize the dialog box controls when i resize the dialog box??:confused:
sruti_p wrote:
How can i resize the dialog box controls when i resize the dialog box?
Either Subclass the control to handle the Dialog resize or use MoveWindow api!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You
-
I am not getting it. This is what my code is: void CEgAppDlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); // TODO: Add your message handler code here CRect wRect,eRect; GetClientRect(wRect); m_edit.GetClientRect(eRect); POINT * pt; pt->x=eRect.left; pt->y=eRect.top; ::ClientToScreen(m_edit.m_hWnd,pt); eRect.bottom+=30; eRect.right+=30; ::MoveWindow(m_edit.m_hWnd,pt->x,pt->y,eRect.Width(), eRect.Height(),TRUE); } I am getting an Exception:((
i guess m_edit.m_hWnd=NULL insert this if(m_edit.m_hWnd!=NULL) { ... }_**
**_
whitesky
-
I am not getting it. This is what my code is: void CEgAppDlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); // TODO: Add your message handler code here CRect wRect,eRect; GetClientRect(wRect); m_edit.GetClientRect(eRect); POINT * pt; pt->x=eRect.left; pt->y=eRect.top; ::ClientToScreen(m_edit.m_hWnd,pt); eRect.bottom+=30; eRect.right+=30; ::MoveWindow(m_edit.m_hWnd,pt->x,pt->y,eRect.Width(), eRect.Height(),TRUE); } I am getting an Exception:((
Hey, just reduce the code lines do as follows void CEgAppDlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); CRect ClientRect( 0, 0, 0, 0 ); GetClientRect( ClientRect ); if( FALSE != IsWindow( m_edit.GetSafeHwnd())) { m_edit.MoveWindow( ClientRect ); } } This code is expected to work only when the Dialog is forcely resize by using Minimize, Maximize, Drag Size etc. To resize the control in Initial state you have to put some similiar code in the OnInitDialog of the dialog class like CRect ClientRect( 0, 0, 0, 0 ); GetClientRect( ClientRect ); m_edit.MoveWindow( ClientRect ); In OnInitDialog you do not have to check the Window handle because OnInitDialog is called after the creation of the Dialog Box and it's control. But you should check the Validity of m_edit window in OnSize because it is called by the framework when the DialogBox alone is created, before the edit is created. OK ? Regards, Benoy Bose