I use a frame that is shown by calling TPopup.Popup(true);
method. If the frame contains a button with the ModalResult
property set (to, for example, mrOK) it closes automatically when clicked by the user. But I need to close the frame in an OnClick
event of a TListBox
in it.
Frame does not have Close method.
I would like to avoid using message posting to the parent form as it might cause future problems when the application is ported to Android as well as I would prefer not to declare the OnClick
event handler for the Frame.ListBox
in the parent Form because the frame might be shown by several different forms and it will worsen the quality of parent Form code making it heavy and difficult to read.
I would highly appreciate suggestions how to do this.
Asked
Active
Viewed 1,108 times
1

asd-tm
- 3,381
- 2
- 24
- 41
2 Answers
2
I found the following way out. I call
(GetParentComponent as TPopup).IsOpen:=false;

asd-tm
- 3,381
- 2
- 24
- 41
-
The reason a frame has no close method is because it is not a form. It is not the frame that closes automatically it is the form that contains it (in this case a TPopup). That is also why your fix works. (Despite appearances, frames are more like components than forms) – Dsm Aug 06 '15 at 09:31
0
When you inherit from TPopUp like explained here (How to make my own dialog component from Firemonkey TPopUp?) then you can call ClosePopup
when an event is trigerred in your frame.