🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.tools.owl
Article #54

Re: Retreive menu width from TFrameWindow

#54
From: actech1
Date: Fri, 23 Jul 1999 00:00
37 lines
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
Technical Details
Message-ID: <3797DA64.4AD3BC79@home.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3797B4F8.1F8317A7@home.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 108ebe,6790accafd3bcc69
X-Google-Attributes: gid108ebe,public
X-Google-Thread: fe201,6790accafd3bcc69
X-Google-Attributes: gidfe201,public
From: actech1 <actech1@home.com>
Subject: Re: Retreive menu width from TFrameWindow
Date: 1999/07/23
Message-ID: <3797DA64.4AD3BC79@home.com>
X-Deja-AN: 504254239
Content-Transfer-Encoding: 7bit
References: <3797B4F8.1F8317A7@home.com>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: abuse@home.net
X-Trace: news.rdc1.il.home.com 932698746 24.2.197.94 (Thu, 22 Jul 1999 19:59:06 PDT)
Organization: @Home Network
MIME-Version: 1.0
NNTP-Posting-Date: Thu, 22 Jul 1999 19:59:06 PDT
Newsgroups: comp.os.ms-windows.programmer.tools.owl,borland.public.cpp.owl