Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > MarkupLabel Control
  New Posts New Posts RSS Feed - Resize dialog to match markup content
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Resize dialog to match markup content

 Post Reply Post Reply
Author
Message
roan98dk View Drop Down
Groupie
Groupie


Joined: 13 February 2011
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote roan98dk Quote  Post ReplyReply Direct Link To This Post Topic: Resize dialog to match markup content
    Posted: 21 July 2011 at 12:12pm
I have a simple CXTPDialog with a single large CXTPMarkupContext area.

Is there a simple way to resize the dialog to fit the content of the CXTPMarkupContext area?

I have looked at the CXTPMarkupUIElement::GetDesiredSize() and similar methods but they do not return a size until the dialog is fully drawn. I try to resize in the OnInitDialog part of the dialog initialization, but perhaps that is the problem?

I am basically using the CMarkupStatic class from the MarkupSample in ToolkitPro v.15.0.2.

Regards
Ronnie
Back to Top
markr View Drop Down
Senior Member
Senior Member


Joined: 01 August 2004
Status: Offline
Points: 443
Post Options Post Options   Thanks (0) Thanks(0)   Quote markr Quote  Post ReplyReply Direct Link To This Post Posted: 22 July 2011 at 9:23am
I have looked at the CXTPMarkupUIElement::GetDesiredSize() and similar methods but they do not return a size until the dialog is fully drawn...

Could you measure the markup directly, and then size the dialog accordingly? Something like this (error handling stripped for brevity):

CXTPMarkupContext* pContext = XTPMarkupCreateContext(0);
CXTPMarkupUIElement* pElement = pContext->Parse("Your markup here");
CSize sz = XTPMarkupMeasureElement(pElement);
pElement->Release();

Then set dialog size based upon markup dimensions?
Back to Top
roan98dk View Drop Down
Groupie
Groupie


Joined: 13 February 2011
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote roan98dk Quote  Post ReplyReply Direct Link To This Post Posted: 22 July 2011 at 10:17am
Thanks, exactly what I was looking for Smile

I had to lock markup width to match dialog static text width, but after that it works perfectly.
Back to Top
markr View Drop Down
Senior Member
Senior Member


Joined: 01 August 2004
Status: Offline
Points: 443
Post Options Post Options   Thanks (0) Thanks(0)   Quote markr Quote  Post ReplyReply Direct Link To This Post Posted: 25 July 2011 at 10:11pm
No problem, glad to help.
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.140 seconds.