Problem
The wicked Windows taskbar hides part of one designed tool window (I don't want it to always be on top).
How to easily get ClientHeight screen?
Detailed description
I designed the RadioGroupDialog template dialog box with a tool window with only TRadioGroup on it with Form->AutoSize = true . It is called through its Execute() method.
In Execute() you need to pass a TStringList with elements to place the TRadioGroup , the header of the dialog form and TRect with the absolute coordinates of the component screen, where the dialog form will be concentrated in (i.e. Place->Left = CallingForm->Left + Component->Left and etc.)
Inside the Execute() code, after executing some type of auto-parsing to select all the TStringList elements in the TRadioGroup and after centering the dialog form at the expected position, the code tries to maintain the position of the dialog inside the screen.
Everything is fine with the upper, left and right borders, but because of the Windows taskbar, the dialog is covered by it :(
If I can detect ClientHeight of the screen, it will be easy to avoid this problem by using it instead of Screen->Height ... It will also help to know the height of the taskbar. Well, I know that this taskbar will be on top, left and right of the screen, so using ClientHeight and ClientWidth would be a better solution.
Execute () Code
//--------------------------------------------------------------------------- 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 the Windows taskbar does
Example: Form1 contains Button1, and when it is clicked, it shows a RadioGroupDialog with four items centered in Button1, labeled "OlΓ‘":
Screen Form: 
The form on the center screen after pressing button 1: 
The form at the bottom of the screen: 
The form at the bottom of the screen after pressing button 1 (see that the 4th element is not displayed): 