Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Dialog not Resizing
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Dialog not Resizing

 Post Reply Post Reply
Author
Message
Raj.krishnan View Drop Down
Groupie
Groupie
Avatar

Joined: 16 January 2006
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote Raj.krishnan Quote  Post ReplyReply Direct Link To This Post Topic: Dialog not Resizing
    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.
 
Resizing needs to happen in maximize mode and compact mode( Refer image attached ).
 
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/
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Shajeer View Drop Down
Newbie
Newbie
Avatar

Joined: 20 January 2006
Location: India
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote Shajeer Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Raj.krishnan View Drop Down
Groupie
Groupie
Avatar

Joined: 16 January 2006
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote Raj.krishnan Quote  Post ReplyReply Direct Link To This Post 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/
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.047 seconds.