Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - HOWTO resize MarkupStatic / move other controls
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

HOWTO resize MarkupStatic / move other controls

 Post Reply Post Reply
Author
Message
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Topic: HOWTO resize MarkupStatic / move other controls
    Posted: 24 February 2011 at 4:31am
Hi;

I created a CXTPResizeDialog derived class containing a CMarkupStatic control on top and immediately below the CMarkupStatic control a CXTPReportControl class.
Whenever the dialog is resized the content of the CMarkupStatic is partly invisible.
How can I ensure, that the size of the control is always big enough to show the whole content and how do I know the new position of the report control?

Here's a picture of what I mean:



Any help is very welcome...


Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 25 February 2011 at 3:05am
Hello;

No solution for this? I can't believe it.
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
cpede View Drop Down
Senior Member
Senior Member


Joined: 13 August 2004
Location: Denmark
Status: Offline
Points: 680
Post Options Post Options   Thanks (0) Thanks(0)   Quote cpede Quote  Post ReplyReply Direct Link To This Post Posted: 25 February 2011 at 5:43am
Well, if you just places controls on a Dialog or Form there is no build-in automatic moving and resizing of the individual controls, and Dialog and Form sizes etc.
 
If you want to have control, you can read the size of the Markup context object and then manually move your Report control up or down accordingly.
 
That is at least the way I do it.
 
-cpede
Product: Xtreme ToolkitPro (24.0.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 25 February 2011 at 5:52am
But how can I read the size of the Markup content. That's what I was looking for...
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
cpede View Drop Down
Senior Member
Senior Member


Joined: 13 August 2004
Location: Denmark
Status: Offline
Points: 680
Post Options Post Options   Thanks (0) Thanks(0)   Quote cpede Quote  Post ReplyReply Direct Link To This Post Posted: 25 February 2011 at 5:58am
I use code like this:
 
 if (m_ctrl.GetSafeHwnd())
 {
   if (m_ctrl.GetUIElement())
   {
     CDC* pDC = m_ctrl.GetDC();
     if (pDC)
     {
        CSize sizeAvailable(rc.Width(),rc.Height());
        CXTPMarkupDrawingContext dc(pDC->m_hDC);
        m_ctrl.GetUIElement()->Measure(&dc,sizeAvailable);
        CSize sizeDesired = m_ctrl.GetUIElement()->GetDesiredSize();
        m_ctrl.ReleaseDC(pDC);
       
m_nHeight = sizeDesired.cy;
     }
   }
   m_ctrl.SetWindowPos(NULL,0,rc.Height()-m_nHeight,rc.Width(),m_nHeight,SWP_NOZORDER);
 }

I don't know if the code is optimal, but it works Smile
 
-cpede
Product: Xtreme ToolkitPro (24.0.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 25 February 2011 at 6:01am
Hi;

Thanks, that's what I was looking for!
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 25 February 2011 at 6:40am
Hi;

I included the suggested code into my OnSize() message handler. But now the report control flickers while resizing. What can I do to prevent this?

Here's the code of my OnSize handler:
void CArticleParameterDlg::OnSize( UINT nType, int cx, int cy )
{
    CXTPResizeDialog::OnSize(nType, cx, cy);

    if (Static_.GetSafeHwnd() && Static_.GetUIElement()) {
        CDC* pDC = Static_.GetDC();
        if (pDC)
        {
            CXTPWindowRect rc(&Static_);
            CSize sizeAvailable(rc.Width(), cy);
            CXTPMarkupDrawingContext dc(pDC->m_hDC);
            Static_.GetUIElement()->Measure(&dc,sizeAvailable);
            CSize sizeDesired = Static_.GetUIElement()->GetDesiredSize();
            Static_.ReleaseDC(pDC);
            rc.bottom=rc.top+sizeAvailable.cy;

            int top=rc.top;
            ScreenToClient(&rc);
            Static_.MoveWindow(rc, FALSE);

            if (Report_.GetSafeHwnd()) {
                CXTPWindowRect rcReport(&Report_);
                rcReport.top=top+sizeDesired.cy+10;
                ScreenToClient(&rcReport);
                Report_.MoveWindow(rcReport, FALSE);
            }
        }
    }

}

Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
cpede View Drop Down
Senior Member
Senior Member


Joined: 13 August 2004
Location: Denmark
Status: Offline
Points: 680
Post Options Post Options   Thanks (0) Thanks(0)   Quote cpede Quote  Post ReplyReply Direct Link To This Post Posted: 25 February 2011 at 6:56am
You probable need to play with the WS_CLIPCHILDREN and WS_CLIPSIBLINGS styles on your Dialog or Form and control.
 
And if owner draw, then remember to return correctly in the OnEraseBkgnd(CDC* pDC) method.
 
-cpede
Product: Xtreme ToolkitPro (24.0.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 25 February 2011 at 7:12am
Hi;

I think it's because of using a CXTPResizeDialog. The CLIP* styles are all set as expected. When I remove my additional code from OnSize() the flicker goes away.
Perhaps Oleg has an idea how to integrate this resize into the CXTPResize() concept.

Nevertheless, thanks for your help.
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
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: 25 February 2011 at 8:31am
Hi,
if you manually position controls, just don't use CXTPResize
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 25 February 2011 at 8:51am
Thanks Oleg! Thumbs Up

Now it works like a charm...

Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
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.