2
votes

Intro:

I have a custom VCL component derived from the TCustomPanel class which purpose is to act as some kind of a custom form which has a parent (main form), but all default buttons such as maximize, minimize, close. That component was developed long before FMX and it's an important part of an existing application. The component is catching messages, overriding the Paint method etc.

The main feature of this component is to have similar functionality as a regular form (floating at runtime within it's parent, dragging ...) but with some customized graphics (smaller buttons etc...)

Demo application

Task at hand:

I am working on rewriting components for FireMonkey (Delphi XE2) including this floating window as well and if there is any point to do that.
(I don't want to mix VCL and FMX because at some point I would like to have whole application in FMX.)

Questions:

  1. Is there any existing FMX control with feature of floating / dragging / moving in runtime?

  2. What is the approach in Firemonkey to enable for an eg. TPanel move in run time or is there a control which offers that functionality by default? I guess the whole idea in FMX is to override existing methods.

  3. Is it possible in same application to have forms with different styles? I am thinking about creating my custom form with custom style. In that case I can have one main form (parent) and child forms which have different style.

Thanks!

1
Don't ask "Do you think..." - you'll get downvoted or get close votes. Instead, ask for specific advice: "How can I..." and if you're concerned about opinions, ask for other approaches you may have missed. I'd suggest improving the formatting, too - eg, make a dot point list of up to three short, one-sentence questions. This is how to get past the SO gremlins and keep what is an interesting question alive :)David
Thanks for the advice. :)Nix
Word of advice, if you're looking to port something to FMX then you shouldn't port it Firemonkey XE2(1.0), FMX was in something like an alpha stage back then and Soo much has changed in XE3&XE4.Peter

1 Answers

2
votes

For 1 and 2, you'll find the OnMouseXXXX events easy enough to use yourself (or the protected virtual methods if you're developing a custom component).

For 3, place a TStyleBook on each form and load the desired style into it (remembering to set the StyleBook property of the form). You can also point the StyleBook property to an instance not on the form, e.g. on another form or to a global object. If you do this beware to nil the StyleBook property of the form before freeing it or you'll get AVs.