TPagecontrol equivalent for Firemonkey - delphi

while changing software development from VCL frame work to Firemonkey, I can not understand where is the TPagecontrol component gone from the good old VCL framework.
I already placed a TTabControl on my Form and added several Tabitemn, bit now I can not find the replacement for the TPagecontrol.

You can take Firemonkey's TTabControl as a replacement for VCL's TPageControl. Their tabs are containers just like everything else in Firemonkey (so unlike the VCL's TTabControl their tabs are real containers).

Related

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

Limitations in native iOS components for Firemonkey

I am very attracted to the idea of using native components for iOS development, so I am testing the two options currently available: TMS iCL and D.P.F iOS Native Components. Unfortunately I found that both of them have limitations that make them cumbersome or impossible to use, though I still hope that I just overlooked something and therefore I ask here.
Limitation I found:
TMS iCL: it requires all native components in the whole application to be on the same form!
D.P.F.: there is no FMX wrapper that allows you to combine it with FMX forms/components.
Here is a simplified edition of what I need. I have 3 forms, a main form with the main menu (as buttons) and two forms I want to slide in. This is the component structure:
MainForm
UINavigationController
UIButtonA
UIButtonB
UIViewController1
FMXwrapper that wraps Form3 (only in TMS iCL)
Form2
UIViewController2
UIButton2
Form3
Various Firemonkey custom controls
Implementation with TMS iCL: FMXwrapper makes it possible to slide in Form3 (which has FMX components), using the command UINavigationController.PushViewController(UIViewController1). I can also slide in UIViewController2, but the components on this form (UIButton2) is not shown, which seem to happen because it is on another form. If TMS iCL really requires all components to be on the same form, then it is useless, unless you make very small apps, but maybe there is a solution to this?
Implementation with D.P.F.: You can actually embed forms from other units, so here I can slide in Form2, but it will only show DPF components on those forms. Therefore sliding in Form3 does not show any components. Is there any solution or workaround to make that work?
Any suggestions how to solve the limitations in either of the component sets?
Use a UITabBarController on Form1 with multiple tabs (instead of Form2). You can slide between the tabs for native controls.
To get the FMX Form3 to slide in you could set TForm.Transparent := True;. Then use Form3.Show; to show the form. Have a TPanel/TRectangle in Form3 that contains your controls. Set TPanel.Position.X := Screen Width; and then animate sliding it in from the right after TForm.Show;
I contacted TMS to solve the problem with showing components from other forms. The components simply needs to be initialized on the form first. The simple solution is to quickly show and hide Form2 in MainForm.FormShow. However, with many "hidden" forms it might cause flickering so TMS suggested to make a small function (see below)
As a bonus, here is my evaluation of the two componentsets:
TMS iCL: Simple but stable
They implement very few of the native properties as published properties in the FMX control. It is not a big problem as you can still access the native object directly and modify its properties, but it requires a more knowledge about the iOS classes and how they work.
It does not include a working Windows target userinterface.
It has the FMX wrapper, which allows you, to some extend, place FMX components inside native components. (normally when you mix native components with FMX components on a form, the native are always in front, so you cannot use native navigation components because they take up the full screen and covers the FMX components)
D.P.F native controls: Comprehensive but less stable
They implement a lot more native properties as published properties in the FMX control. It makes it a lot faster to work with, especially if you are not familiar with the iOS native controls and their properties.
It does allow you to test your program on Windows (which is much faster than running it on the iOS simulator), as the controls actually works in Windows. Of course the graphics is simplified, but the purpose of this is to test functionality and not the user interface.
There is no way to mix FMX and native components, though you can place native components on a form with FMX components with the limitation as mentioned in TMS point 3.
Conclusion: In the end I decided to buy TMS iCL, for two reasons:
I have a lot of custom controls that I don't want to convert to iOS custom controls, so the FMX wrapper is indispensable for me.
I can get support. For a company this is much cheaper than a free solution without support where you have to spend hours to figure out everything yourself.
The procedure suggested by TMS:
TMainForm
...
procedure InitializeControl(AControl: TControl);
...
implementation
...
procedure TMainForm.InitializeControl(AControl: TControl);
var I: Integer;
begin
if not Assigned(AControl) then
Exit;
if AControl is TTMSFMXNativeUIBaseControl then
begin
(AControl as TTMSFMXNativeUIBaseControl).Initialize;
for I := 0 to AControl.ControlsCount - 1 do
InitializeControl(AControl.Controls[I]);
end;
end;
...
InitializeControl(Form2.TMSFMXNativeUIViewController2);

define a page control as a jvcl dockserver.custom dock panel. is it possible?

I have a main form with a left panel and in the center of the form I have a page control..and I am trying to dock other forms on the page control, as I have seen on an example made by Alister Christie; the thing is that the dragging of forms into the pagecontrol is lazy; I've discovered that a JVCL dockserver and a JVCL dockclient will help me with this.. the thing is that I want to assign pagecontrol to JVCL dockserver as a custom dock panel, but i don't know how to do it: here is the code i wrote on the oncreate event of mainform
procedure Tform1.FormCreate(Sender: TObject);
begin
jvdockserver1.CustomDockPanel := jvpagecontrol1;
end;
could you please help me out?
Forgot to mention that I am a kind of a novice in programmning and I am using Delphi XE2;
The JVCL Docking server component can only accept a PANEL as a docking location, either one of the built in ones, or a custom TPanel that you place on your form at designtime. However the Jedi Docking library will create page controls for you if you want it to. However, it has to be the one that manages them, because those controls could get moved (by you or by some other jvdocking code).
So, if you want to have some tabs visible, you should not try to use your own page control, instead you should use the Docking In Code Demo as your sample, which comes with the JVCL, in the folder jvcl\examples\JvDocking\DockingInCode.
Here is what the tabs look like that the JvDocking system makes for you, using the CustomDockPanel where the custom dock panel is attached to a TPanel, and then JvDocking "creates a page control" automatically for you when you need it:
Note that the pages are created or destroyed by the docking system, and the underlying work of managing the tabs is done by the JvDocking library, not by you.
The main thing you need to do is use this code from MainFm.pas:
tabHost := ManualTabDock( ctrl, newDocFm1, newDocFm2);

Delphi Xe2 with Firemonkey : Can you have a non-client area that is painted in a style other than the default Windows nonclient paint style?

Here is a sample of a delphi application I am making using firemonkey + Delphi XE2.
As you can see, you can use the visual style "stylebook" in Firemonkey to customize the appearance of most things inside the window frame. However the outside of the window frame is drawn using whatever style Windows decides. Now if I was using VCL instead of Firemonkey, I could apply "VCL Styles" and "skin" the whole VCL application in a dark color scheme.
My guess is that this is NOT YET posssible with Delphi XE2 + Firemonkey. Can anyone show how to do this?
At designtime, the "preview" of your form shows a nice black border. But when I run my app, the Windows XP "Luna" theme border (the blue parts in the picture below) looks atrocious. Ironically, the VCL is prettier (in XE2 with styles) than Firemonkey...
You can create a VCL Forms application as usual, with styles if you like, at runtime load your Firemonkey form and set your VCL form as its parent:
uses
FMX.Platform.Win, FMX.Forms,
Unit2;
procedure TForm1.FormCreate(Sender: TObject);
var
Form2: TForm2;
begin
Form2 := TForm2.Create(nil);
Form2.BorderStyle := FMX.Forms.TFmxFormBorderStyle.bsNone;
Form2.SetBounds(0, 0, ClientWidth, ClientHeight);
Winapi.Windows.SetParent(FmxHandleToHWND(Form2.Handle), Handle);
Form2.Show;
end;
In the following screenshot, Form1 is the VCL application main form (with Carbon style) and the dark-grey area with the button is the embedded Firemonkey form:
Note that I'm not handling resizing of the parent window - it should resize the emebedded form, too, emulating alClient alignment.
It seems there are many potential problems with this approach - I think there's a reason why the IDE doesn't let you easily mix Firemonkey forms with VCL forms - it warns about possible "compilation errors or unexpected behavior."
Firemonkey is cross platform. By and large you cannot do anything that is platform dependent within the FMX framework itself. You can however make calls to the underlying platform (be it windows, OSX or iOS) to access platform specific functionality. This should be done within conditionally compiled code.
eg.
{$IF DCC}
something;
{$ENDIF}
{$IF FPC}
somethingelse;
{$ENDIF}
Looking at it from another viewpoint, it may be possible for you do do all of your FMX work on a TRectangle (for example), then use AddObject (or assign its parent), to a VCL form.
If you change the forms BorderStyle to bsNone, you can add whatever chrome you want. You will, of course, need to manually handle maximise, minimise, close, resize etc actions.

How do I make dockable forms like the IDE's without the very slow freezing movement of the dockable form?

How do I do the IDE method or eventually make the basic dock method without the very slow freezing movement of the dockable form?
When I Googled for dockable forms in Delphi and found a post by Zibadian on Programmers Heaven:
First off: The windows in the Delphi IDE aren't MDI forms, by SDI forms.
Now to create a dockable window.
Form2 will be dockable and Form1 will be the place to dock it to. Place a control (such as a TPanel) on Form1 to serve a DockSite. Make sure that you set the DockSite and the UseDockManager properties to true for that control.
For Form2 set the DragKind to dkDrop, the DragMode to dmAutomatic and UseDockManager to true.
That was the basic dock function. If you run your program, show the Form2 and drag that form over the docksite, it should dock at that site. You can even undock it by grabbing the "caption" as you have seen in the IDE.
For me, that method moves the dockable form very slowly. However, Zibadian's answer continues to describe how the IDE does it instead:
The dock-method of the IDE is a little more complex, since you don't see the docksite. I think, you need to write a Form1.OnDockOver or Form1.OnDockDrop to perform that. That (Those) event(s) need to show the docksite at the appropriate location.
Have a look at the Using the TDockTabSet component article by Jeremy North. It is a few years old but should give you some helpful pointers.
Try the JVCL Docking library

Resources