c++builder - How to get ClientHeight of Screen on C++ Builder -


issue

the evil windows taskbar hiding part of 1 designed tool window (i don't wanna on top).

how clientheight of screen easily????

detailed description

i designed template dialog, radiogroupdialog, tool window tradiogroup on it, form->autosize = true. called through execute() method.

on execute(), 1 has pass tstringlist items put on tradiogroup, caption of dialog form , trect screen absolute coordinates of component dialog form centered in (i.e., place->left = callingform->left + component->leftetc.)

inside code of execute(), after performing type of autosize allocate elements of tstringlist in tradiogroup , after centering dialog form in expected position, code tries maintain dialog position inside screen.

it ok up, left , right borders, but, because of windows taskbar, dialog covered :(

if can discover clientheight of screen, easy avoid issue using instead of screen->height... knowing taskbar height help. well, know that taskbar on top, on left , on right of screen too, using clientheight , clientwidth best solution..

the code of execute()

//--------------------------------------------------------------------------- int __fastcall tradiogroupdialog::execute(tstringlist *str, ansistring dlgcaption, trect place) {     modalresult = 0;      caption = dlgcaption;      radiogroup1->items->clear();     radiogroup1->items->addstrings(str);      int theheight = 30*radiogroup1->items->count;     int maxheight = 4*screen->height/5;     int minheight = 30;      if(theheight > maxheight)     {         theheight = maxheight;     }     else if(theheight < minheight)     {         theheight = minheight;     }      radiogroup1->height = theheight;      left = ((place.left + place.right)/2) - width / 2;     top = ((place.top + place.bottom)/2) - height / 2;      if(left + width > screen->width)     {         left = screen->width - width;     }      if(top + height > screen->height)     {         top = screen->height - height;     }      if(left < 0)     {         left = 0;     }      if(top < 0)     {         top = 0;     }      radiogroup1->itemindex = -1;      return showmodal(); } //--------------------------------------------------------------------------- 

the ugly thing windows taskbar does

example: form1 contains button1, , when pressed shows radiogroupdialog 4 items centered in button1 "olá" of dialog caption:

  • form on screen center: 1

  • form on screen center after button1 pressed: 2

  • form on bottom of screen: 3

  • form on bottom of screen after button1 pressed (see 4th item not shown): 4

use screen->workarea... (left/top/width/height/rect) properties coordinates , dimensions of screen's working area, not obscured taskbar , other toolbars.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -