Issue with BringToFront in Firemonkey - delphi

I have two controls on my form.
TWebBrowser with Align set to Client
TMemo with Align set to None
I want to display TMemo on top of TWebBrowser for a particular scenario and for that am using Memo.BringToFront but it does nothing.
Am I missing something?

TWebBrowser Is a particular firemonkey Control. Firemonkey control are "paint" according to their z-order on a openGL surface (ie: the form). but TwebBrowser is a native control that is draw on another surface that is placed on the top of the form, hidding in this way everything back to it.
The only way you can do is to show you memo inside another window on the top of the TwebBrowser. for this you can use a native Memo. As far as i know their is only one native memo implemented on android (delphi already have some that work on ios/windows) it's https://github.com/Zeus64/alcinoe

Related

How to paint all VCL Styles tab sheet controls to a given canvas when the tab is not visible to the user?

Using C++ Builder 10.2, VCL & VCL Styles...
I have a TPageControl that has TFrames on each of its TTabsheets. One of these frames contains some TEdit controls that show data read from a device. After the reading is acquired and the frame is updated, the system may create a screenshot of this frame and store it in a jpeg file.
Since the TTabsheet in the TPageControl with the TEdit controls may not be visible when the jpeg is created, the jpeg may not have the text contents of the TEdit controls painted. This has given me fits.
I have found that by using a TStaticText that is styled, the text appears in the jpeg. This seems to be due to the fact that TStaticTextStyleHook.Paint (in VCL.StdCtrls.pas) draws the control itself rather than letting Windows do it.
There are two problems with using TStaticText. Selecting the SystemStyle choice (Windows) causes TStaticTextStyleHook.Paint to skip painting the control itself and delegates to Windows (I think). Also, the appearance of TStaticText isn't exactly what I want, but I may have to live with it.
Is Windows refusing to paint TEdit control contents because the parent is not Visible?
Is there a way to force Windows to paint the TEdit controls in this situation?
UpdateWindow() and RedrawWindow() does not work.

TPanel in Embarcadero Rad Studio

I have a TMapView. Above the TPanel. Problem is that the map visible through the TPanel. How to make background non-transparent for TPanel
There are no way to show panel (or any other styled FMX control) on the TMapView, TWebBrowser, other controls with ControlType = Platform (like TEdit) on mobile platforms.
TMapView is a wrapper around native control. Native controls always shown on top of form because of differences in the mechanism of rendering. Like in VCL, TEdit always displayed above TLabel, because TEdit is descendant of TCustomControl, which painting controlled by OS, and TLabel is descendant of TGraphicControl, which painting controlled by form.
If you want to show some controls above TMapView/TWebBrowser, etc..., you should use only native controls.
a good explanation is given on http://www.tmssoftware.com/site/fmxicl.asp

Embedding a VCL form in an FMX ScalingLayout

I am trying to embed a VCL form in an FMX form, where the FMX form contains a TScalingLayout set to alClient so that on form resize the entire content is scaled.
The only way I have found to embed the VCL form in FMX Form in the first place is like so:
VCLForm.ParentWindow := WindowHandleToPlatform(FMXForm.Handle).Wnd;
VCLForm.Show;
Unfortunately this leaves me unable to parent the VCLForm to my TScalingLayout directly, so when I resize my FMX form naturally the embedded VCL form does not scale.
I thought that if I can only put the VCL form onto a form directly I could just use another FMX form as a container and embed this container form in my ScalingLayout, but since I can only "embed" an FMX form in another by moving all its children my VCL form won't be moved.
Is there a way to embed my VCL form in a way that will scale its content in the same way all the FMX controls on my ScalingLayout are scaled ?
No it is not possible. The reason Firemonkey can scale its components is because Firemonkey makes and draws them all by itself from scratch.
Most VCL controls are made out of built-in Windows OS components that your program calls. And those don't have any ability to scale. They are not drawn by the VCL, the VCL tells Windows to draw them. So if FMX does not draw them, it cant scale them.

Greyed TWebBrowser control

When TWebBrowser control is too small it becomes greyed.
If TWebBrowser control is aligned to alClient and there are no other controls on the form I can make it really small (50x10 for example). However, when I add other controls like panels, toolbar, main menu and so on which all float on top (alTop) - the more controls I add it seems, the smaller window of TWebBrowser I can get without greying itself. When window is resized to become larger, then it becomes ungreyed again.
In this example I placed TToolBar with 2 buttons aligned to alTop, and TWebBrowser aligned to alClient. If I make toolbar invisible, I can make web browser really small. However, with toolbar visible it greys itself. The more controls I add it seems to have less and less usable space before greying itself.
As you can see in last example web browser is even smaller than in second example but still visible and everything is the same except there is no toolbar on top. Same applies if used on Windows 7 or 8 or with Internet Explorer 10 or 11.
The examples here are just examples. I don't have a problem with having 100x100 control as minimum size. The problem is that when I place quite a bit of controls then it doesn't allow me to have smaller control than 550x250, which is quite large.
Can anyone enlighten me why other controls have an effect on web browser not being able to use smaller size when it can do this perfectly normally when there are no other controls on form?
Many thanks to bummi in the comments up there for finding a following workaround:
It appears that the problem with greyed control doesn't appear in XE3 and later but can be reproduced in earlier versions like XE2, XE, 2010 and 2009.
For these earlier versions the workaround is to place TWebBrowser on another control such as TPanel and then align both controls to alClient (so that the TWebBrowser fills entire TPanel and TPanel fills entire area previously filled by TWebBrowser). Of course, alignment here is not an issue but the workaround is just to place one control on another.
The same works for TEmbeddedWB and probably other controls that host Internet Explorer ActiveX control.
When placed on container control like TPanel, web browser can be resized to any size without the problem described above.

TGridPanel no transparency if themes disabled in Win7

I have a form filled with a TImage. I put over this a TGridPanel. If themes are enabled in Windows 7 the TGirdPanel appears with transparency. If themes are disabled (no visual styles) the TGridPanel loses transparency and hides the part it ocupies. I use Delphi XE2
Is there any workaround for this?
That's a basic fact of life for panels. It's not special to the TGridPanel, you will see the same effect for any control derived from TCustomPanel. The transparency is only supported when the application is themed.
The grid panel is just a convenient way to layout your controls. If you want to support running unthemed then the simplest solution is to remove the TGridPanel and layout your controls manually. That's pretty much trivial to do. Handle the OnResize event of the control that currently contains the panel, and position your controls as desired.

Resources