[solved] How to know the width/height of a non opened Window ?

3 posts / 0 new
Last post
zzd10h
zzd10h's picture
Offline
Last seen: 4 years 10 months ago
Joined: 2012-08-24 20:56
[solved] How to know the width/height of a non opened Window ?
Hi, I'm building a window with dynamic added gadgets inside. All works but I wonder how to know the Width and Height of a window BEFORE to open it. I want to use these informations to position my window on the screen before to open it without to use WINDOW_Position. Is it possible ? the following function returns "0 x 0" before WM_OPEN and "476 x 68" after that the window is opened
  1. uint32 Width = 0 ; uint32 Height = 0 ;
  2.  
  3. GetAttrs(win,WA_Width,&Width,WA_Height, &Height,TAG_DONE);
  4. printf("%ld x %ld \n",Width,Height);
  5.  
  6. window = (struct Window *)IDoMethod(win, WM_OPEN);
  7.  
  8. GetAttrs(win,WA_Width,&Width,WA_Height, &Height,TAG_DONE);
  9. printf("%ld x %ld \n",Width,Height);
Thank you by advance.
broadblues
broadblues's picture
Offline
Last seen: 2 years 7 months ago
Joined: 2012-05-02 21:48
ILayout->LayoutLimits() will
ILayout->LayoutLimits() will enable you to determine the size of the layout and hence the values of WA_InnerWidth and WA_InnerHieght, but the other details depend on the user preferences for border styles etc. Unless your window is borderless of course .... What's wrong with WINDOW_Position ?
zzd10h
zzd10h's picture
Offline
Last seen: 4 years 10 months ago
Joined: 2012-08-24 20:56
Thank you, LayoutLimits is
Thank you, LayoutLimits is was I needed, it gives me my window dimensions. Wonderful. And as my window is borderless, no problem. WINDOW_Position is not useful for my case because, I want to be able to specify where will be located my window according to his width and/or height. For example, at X = 500 but at the extrem right of my screen. To be able to make that, I have to know at least the width of my window. Maybe that I understad wrong the autodocs but I don't find a suitable WPOS for my need. WPOS_CENTERSCREEN - Center on screen WPOS_CENTERWINDOW - Center in another window WPOS_CENTERMOUSE - Center under mouse WPOS_TOPLEFT - Open top/left, just below screen bar WPOS_FULLSCREEN - Open top/left and fill visible clip Thank you again for your help, Broadblues ;)
Log in or register to post comments