Thread View: comp.os.ms-windows.programmer.tools.owl
2 messages
2 total messages
Started by actech1
Fri, 23 Jul 1999 00:00
Retreive menu width from TFrameWindow
Author: actech1
Date: Fri, 23 Jul 1999 00:00
Date: Fri, 23 Jul 1999 00:00
14 lines
1329 bytes
1329 bytes
I have a TFrameWindow with an assigned menu. wfShrinkToClient causes the window to shrink smaller than the menu width. (The Window is otherwise empty). I can hard code a width and it will work fine. However, when used on a higher resolution display, part of the menu is chopped off on the right side. I suspect this is caused by the fixed pixel width and the Menu using a greater number of pixels to maintain the large font size. Is there a way to retreive the desired menu width so that I can use this to resize the window dynamically tia
Re: Retreive menu width from TFrameWindow
Author: actech1
Date: Fri, 23 Jul 1999 00:00
Date: Fri, 23 Jul 1999 00:00
37 lines
2036 bytes
2036 bytes
Found my own answer after trial and error:
This isn't terribly universal but it suits my needs:
#define FRAMEWIDTH 300 // these are the heights at my preferred resolution
#define FRAMEHEIGHT 49
TDefaultGUIFont sysfont = TDefaultGUIFont();
TEXTMETRIC tm = sysfont.GetTextMetrics();
TSize size;
((TGadgetWindow*)sb)->GetDesiredSize(size); // sb is the
TStatusBar
frame->Attr.W = FRAMEWIDTH/5 * tm.tmAveCharWidth; // 5 is the char
width at preferred res.
frame->Attr.H = FRAMEHEIGHT + size.cy;
ideally this would dynamically size the menu, but idealism is a dangerous
thing....
actech1 wrote:
> I have a TFrameWindow with an assigned menu. wfShrinkToClient causes the
> window to shrink smaller than the menu width. (The Window is otherwise
> empty).
>
> I can hard code a width and it will work fine. However, when used on a
> higher resolution display, part of the menu is chopped off on the right
> side. I suspect this is caused by the fixed pixel width and the Menu
> using a greater number of pixels to maintain the large font size.
>
> Is there a way to retreive the desired menu width so that I can use this
> to resize the window dynamically
>
> tia
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads