PDA

View Full Version : SDK: Resizing IRollupPanels


RustyKnight
01-11-2008, 06:18 AM
A curious question...

Does anyone know how to resize a IRollupPanel??

Silly question I know, but I need to be able dynamically change the window size...

I've played around with the MoveWindow function but it didn't quite work out...

Shane

scorpion007
01-12-2008, 01:07 AM
You generally shouldn't be playing with the width of individual panels, as the rollup window maintains a list of panels, that should hopefully be of the same width. Hacking one panel involves setting more than the size of the dialog, as a panel is built from a number of windows (the title bar, container, etc). Even if you did change all these windows, the rollup window manager would probably forget your change due to its internal state not being affected. Not to mention, it wouldn't be a good idea to have one panel being too wide to fit into the RollupWindow that contains it -- the RollupWindow doesn't support horizontal scrolling.

You can however programmatically, and safely, change the height of individual panels, without breaking the system, by calling IRollupPanel::SetDlgHeight(). If you were to just directly manipulate the HWND of a panel and resize it, it would cause havoc on the panels below it -- it's the job of RollupWindow to handle the propagation of these changes to each window it owns.

RustyKnight
01-12-2008, 01:20 AM
You generally shouldn't be playing with the width of individual panels, as the rollup window maintains a list of panels, that should hopefully be of the same width. Hacking one panel involves setting more than the size of the dialog, as a panel is built from a number of windows (the title bar, container, etc). Even if you did change all these windows, the rollup window manager would probably forget your change due to its internal state not being affected. Not to mention, it wouldn't be a good idea to have one panel being too wide to fit into the RollupWindow that contains it -- the RollupWindow doesn't support horizontal scrolling.

You can however programmatically, and safely, change the height of individual panels, without breaking the system, by calling IRollupPanel::SetDlgHeight(). If you were to just directly manipulate the HWND of a panel and resize it, it would cause havoc on the panels below it -- it's the job of RollupWindow to handle the propagation of these changes to each window it owns.Thank you for that clarification, it helps.

I was hopping to be able to determine the width dynamically and runtime, but it is not a major issue, just annoying.

Once again, very useful and informative, very appriciated!

Shane

scorpion007
01-12-2008, 02:30 AM
Sure, if all you want to is read the width at runtime, that's safe and easy to do.

Use GetClientRect or GetWindowRect. In this case it shouldn't matter which since they are child windows with no border.

If you want the width of your panel for example, use something like:

RECT rc;
IRollupPanel *irp = <something>; // pretend it's initialized
GetClientRect(irp->GetPanelWnd(), &rc);
int width = rc.right - rc.left; // here's your width.

RustyKnight
01-12-2008, 03:40 AM
Sure, if all you want to is read the width at runtime, that's safe and easy to do.

Use GetClientRect or GetWindowRect. In this case it shouldn't matter which since they are child windows with no border.

If you want the width of your panel for example, use something like:

RECT rc;
IRollupPanel *irp = <something>; // pretend it's initialized
GetClientRect(irp->GetPanelWnd(), &rc);
int width = rc.right - rc.left; // here's your width.
Opps, should said "set"...but that helps to

Shame

CGTalk Moderation
01-12-2008, 03:40 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.