Print Page | Close Window

Dialog not Resizing

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=4254
Printed Date: 16 July 2025 at 2:11pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Dialog not Resizing
Posted By: Raj.krishnan
Subject: Dialog not Resizing
Date Posted: 20 May 2006 at 4:04pm
We have developed a dialog based application in VC++ 6.0.
We have integrated XTreme toolkit 9.81 into the application.The problem we
now face is that we are not able to resize the dialog eventhough we have derived
the dialog from CXTResize and the property of the dialog is also set
to resizing.
 
https://forum.codejock.com/uploads/Rajkrishnan/2006-05-20_160426_Resizing_Modes.zip - 2006-05-20_160426_Resizing_Modes.zip
Resizing needs to happen in maximize mode and compact mode( Refer image attached ).
 
https://forum.codejock.com/uploads/Rajkrishnan/2006-05-20_160406_Source.zip - 2006-05-20_160406_Source.zip
A sample application and the source code for the same is attached.Please follow the steps mentioned below.
 
Can you please help us to resolve this issue ASAP .
 
 
Things to be followed while using the Source code:       
 
1) Unzip the workspace
2) Make sure that you are compiling in the debug mode ( donot do it in    
    release mode - since we deleted few resources it will not work in release mode)
3) Give your executable path in the settings
    ( Projects -> Settings -> Debug Tab )
4) After executing, a dialog will be displayed in which we are not able to
    resize, both in maximized mode as well as compactible mode.


-------------
Raj
Software Engineer
eGrabber Inc
http://vcfreax.blogspot.com/



Replies:
Posted By: Oleg
Date Posted: 21 May 2006 at 9:35am

Some hints:

1. You totally removed all borders:

ModifyStyle(WS_BORDER|WS_DLGFRAME|WS_THICKFRAME,0);

So window has no border/has no nonclient area.

2. Because your dialog have no nonclient area/borders

You must manually catch WM_SETCURSOR to change resize cursor and WM_LBUTTONDOWN to send WM_SYSCOMMAND to resize client

sample:

BOOL CToolDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
 CPoint pt;
 GetCursorPos(&pt);
 CRect rc;
 GetWindowRect(&rc);
 if (pt.x > rc.right - 4)
 {
  SetCursor(LoadCursor(0, IDC_SIZEWE));
  return TRUE;
 }
 
 
 return CDialogSampleDlgBase::OnSetCursor(pWnd, nHitTest, message);
}

void CToolDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
 CPoint pt;
 GetCursorPos(&pt);
 CRect rc;
 GetWindowRect(&rc);
 if (pt.x > rc.right - 4)
 {
  SendMessage(WM_SYSCOMMAND, SC_SIZE + (HTRIGHT - HTSIZEFIRST + 1),
   MAKELPARAM(pt.x, pt.y));

  return;
 }
 
 CDialogSampleDlgBase::OnLButtonDown(nFlags, point);
}



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Shajeer
Date Posted: 22 May 2006 at 6:29am

Thanks oleg for your speedy reply

But we are not able to resize on the top ( It is not recieving WM_LBUTTONDOWN when clicked on the top ) Please advice

Can you also advice how to bring the resize gripper on the right bottom most corner.

 

our code

//////////////

BOOL CToolDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
 CPoint pt;
 GetCursorPos(&pt);

 CRect rc;
 GetWindowRect(&rc);

 if ( pt.x > rc.right - 4 )
 {
  SetCursor( LoadCursor(0, IDC_SIZEWE) );
  return TRUE;
 }  

 if ( pt.x == rc.left )
 {
  SetCursor( LoadCursor(0, IDC_SIZEWE) );
  return TRUE;
 }

 if ( pt.y == rc.top  )
 {
  SetCursor( LoadCursor(0, IDC_SIZENS) );
  return TRUE;
 }

 if ( pt.y > rc.bottom -4  )
 {
  SetCursor( LoadCursor(0, IDC_SIZENWSE) );
  return TRUE;
 }

 return CDialog::OnSetCursor(pWnd, nHitTest, message);
}

void CToolDlg::OnLButtonDown(UINT nFlags, CPoint point)
{

 CPoint pt;
 GetCursorPos(&pt);
 CRect rc;
 GetWindowRect(&rc);

 if ( pt.x > rc.right - 4 )
 {
  SendMessage(WM_SYSCOMMAND, SC_SIZE + (HTRIGHT - HTSIZEFIRST + 1),
   MAKELPARAM(pt.x, pt.y));  
  return;
 }

 if ( pt.x == rc.left )
 {
  SendMessage(WM_SYSCOMMAND, SC_SIZE + (HTLEFT - HTSIZEFIRST + 1),
   MAKELPARAM(pt.x, pt.y));
  return ;
 }

 if ( pt.y == rc.top  )
 {  
  SendMessage(WM_SYSCOMMAND, SC_SIZE + ( HTTOP - HTSIZELAST + 1 ),
   MAKELPARAM(pt.x, pt.y));
  return ;
 }

 if ( pt.y > rc.bottom -4  )
 {
  SendMessage(WM_SYSCOMMAND, SC_SIZE + (HTBOTTOMRIGHT - HTSIZEFIRST + 1),
   MAKELPARAM(pt.x, pt.y));
  return ;
 }

Thanks



Posted By: Oleg
Date Posted: 22 May 2006 at 2:34pm

Hi,

you don't receive WM_LBUTTONDOWN for "top" border because you cantch WM_NCHITTEST and return HTCAPTION instead of HTCLIENT for top border...



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Raj.krishnan
Date Posted: 02 September 2006 at 6:20am
Hi Oleg ,
 
When i try to Add a Rich Edit Control to the dialog while Resizing lots of flickering happens . We are painting the dialog with Gradient fill in WM_PAINT message so while Resizing dialog is InValidating
 
We tried certain methods like OnEraseBkGnd message to avoid flickering .Can you please help me to sort out the issue of flickering .
 
 


-------------
Raj
Software Engineer
eGrabber Inc
http://vcfreax.blogspot.com/



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net