Firemonkey: How to make a control visible, when it goes out of the bounds of its parent


I have a search box control that is used for populating form information in my application. Essentially, it is a text box, tied to a table in a database. Typing into the text box displays search results in a TGrid below.

Everything works fine, except when a search box control is close to the bottom of a form. When the results grid takes up more space than it has on the form, part of the grid gets cut off. (Note that the parent of the grid, is set to be the parent form of the search box)

Originally, to solve this I thought I would calculate the amount of space I had available, and size the grid accordingly. Any results that could not fit on the screen could be accessed via a scroll bar.

TCommonCustomForm * RootForm = dynamic_cast(this->Root->GetObject());

long HeightAvailable = RootForm->ClientHeight – Point.Y – this->Height;

if( FGrid->Height > HeightAvailable )
FGrid->Height = HeightAvailable;
else if ( FGrid->Height > MaxHeight )
FGrid->Height = MaxHeight;

However, as you can see in the next image, this didn’t exactly work either.

At this point I am at a loss.

Is there any way I can allow this grid to be shown past its parent control?

Comments are closed.