SITUATION
I am creating an app for a customer and my boss told me to add an action bar with a button that displays some other things. This screenshot will clarify:
The dark green bar above with (and the white text) is a TLayout aligned at Top with a ColorBox. On the right you can see that I have a button and, when you click on it, you see a TListBox with some options. When the user clicks on them, an action is performed.
PROBLEM
The TListBox is not visible when the form creates. When you click on the button the box appears thanks to this code:
procedure TForm1.ButtonMenuClick(Sender: TObject);
begin
//oflowmen is the TListBox
oflowmen.Visible := not oflowmen.Visible;
if oflowmen.Visible then
begin
oflowmen.ApplyStyleLookup;
oflowmen.RealignContent;
end;
end;
This code works fine because when you click on the button, the TListBox appears/disappears, but this is not enough. I want my box to disappear in 2 ways:
When I click again on the button (solution that I have implemented above)
When I click somewhere in the screen (excluding the button of course)
How can I implement the second case?
Note: I put a screenshot of a 32 bit exe instead of a screenshot from my android test device, but it’s the same thing.