Maybe I don't understand something in your requirements for the flying stuff, but I think I've made something similar without any specific tricks. In my project XML Tree Editor you can find a search form, which communicates with the main form or a notification, which does nothing, but still reacts on user clicks or clicks outside it. ...
Hi vrull, I've learn your code. Thanks you for show us your codes.
I need something like that, but without deactivate the main form.
I may use the message mechanism for future when I am ready to the next step.
----------------------------------------------
Dear Tazz..
Oh, I am not notice before about the z order. Yes, those 2 property make my "popup" form always on top of it's PopupParent (the mainform).
Okay, now...
So far, we found 2 candidate solution:
* Your CustomCombobox (TForm)
and
* "My" Popup (TWincontrol). It's not exactly mine, I am not the original author, but I bring it here.
so just to distinct it with your suggested solution I call it "my".
I repeat again:
I have to make a choice between 2 solution as a solution of flying container question:
1 -> Using TForm (or TCustomForm) as flying container +PopupMode + PopupParent
2 -> Using TWinControl with hack ( +CreateParams +CreateWnd +event.Show(). )
Pro & Con :
* First solution,
(+) Already Lazarus cross platform.
(+) it also give us a chance to arrange controls such buttons, labels, TEdit visually.
( - ) But it always change the mainform activation (shown by color of mainform's titlebar).
* Second solution,
( - ) currently Lazarus in Windows only.
(+) It never activated (mean: mainform's title bar color seem as the active control).
( - ) Sadly, it doesn't give us ability to arrange controls visually (via form designer in design-time).
---------------------
So, I think it maybe better if we could marriage both solution, := make a new hybrid solution (rather than choosing only one of them)
:
A. -->
Transfer the content in runtime. Suppose we put & arrange some controls (buttons, labels, TEdits) in a form (like your combobox form)
And, when it needed to be shown (in runtime), we create a new TWincontrol and transfer the
form's children into that new TWincontrol created.
B. -->
Make it designable visually in :
The "flying TWincontrol" it self is inherited from a TWincontrol which is already available in lazarus
(visible in design time).
We can create a new TWincontrol (+hack for flying capability) based on TPanel, for example.
By this, your expectation to able to put and move any buttons, labels, combobox will be achieved.
Solution A: not only from TForm, it might also transfered it's children from TPanel.
Solution B: no need to transfer, it self able to fly when needed.
The goal of both solutions is to bring a flying window (TWinControl) in runtime, plus ability to arrange/move controls in design time, PLUS:
without changing the current active form (mainform must be remain active control).
The difference between them is : implementing Solution B need registering of that new LCL by installing a new component package (*.lpk), therefor we must put that hacked panel into our form from component palette (as similar as putting a TPanel from Lazarus's Component Palette).
---------------------------
I mean, PopupMode and PopupParent of TForm are OK, except I just dislike that using TForm will always grab it's parent-form's Active property. While I expect the PopupParent will always the active.
In other hand, if we success to work with TWinControl as popup form, I am not sure if we can make it cross platform (run well in WIndows, Linux, MacOS)
What is your oppinion ?
-------------------
Thanks you!