Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Having problems with my first FireMonkey app


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 11 - Last Post: Jan 2, 2017 8:07 AM Last Post By: Robert Griffin
Robert Griffin

Posts: 97
Registered: 6/1/03
Having problems with my first FireMonkey app  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 28, 2016 11:00 PM
I am creating my 1st Firemonkey app in Berlin 1.1. Everything is working in my Windows version, and it is out for beta testing right now. **EDIT** I actually am using Berline 10.1 Update 2.

My MacOS version though isn't displaying things correctly, especially on TPanels. I have a TPanel that has multiple controls. Although the panel is visible on the mainform in the IDE and when running on Windows, I had actually to code that Panels Visible := true in my MainForm.OnShow event just to get the controls to display on the panel. Not sure why I had to do it, but it is working right now. I also had to code the correct alignments and widths on those controls.

I also have a TTabControl with 2 Tabs. The Tabs only show a gray bar on MacOS, but display correctly on Windows. So to keep the two apps as close to the same, I set the Tab Height to 1. That is fine until I go to the 2nd tab. Again, I only have two controls there. A TWebBrowser and a TToolbar with one button. I had to set the visibility to the WebBrowser to true to get it to display, but the toolbar is just a dark gray bar. My one TButton, not matter what I try to do, the toolbar never shows the button. It is there, though. I can click on it. It is just not physically visible.

This was the same thing happened on my first panel. I thought the controls weren't there until I started clicking around. You just can't see them.

I have another panel that is only visible when I need to display a description, with one label and two buttons. I have tried everything, but those controls don't show, but I can click on the buttons since I know where they are. I could put a label on the panel that says 'click around and if you find a button win a prize', but it wouldn't display.

I know there must be a simple answer to all of this since when I search for an answer, I don't find anything. What could I be doing, or setting wrong?

Here is my Uses Clause. Maybe there is some sort of conflict there:

{$IFDEF MSWINDOWS}
Winapi.ShellAPI, Winapi.Windows,
{$ENDIF MSWINDOWS}
{$IFDEF MACOS}
Macapi.CoreFoundation, //Posix.Stdlib,
{$ENDIF MACOS}
System.DateUtils,System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Dialogs, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Menus,
FMX.Controls.Presentation, FMX.StdCtrls, FMX.TabControl,
System.Rtti, FMX.Grid.Style, FMX.ScrollBox, FMX.Grid, Fmx.Bind.Grid,
System.Bindings.Outputs, Fmx.Bind.Editors, Data.Bind.Controls,
Data.Bind.EngExt, Fmx.Bind.DBEngExt, Data.Bind.Components, FMX.Layouts,
Fmx.Bind.Navigator, Data.Bind.Grid, FMX.TreeView,
FMX.MultiView, System.ImageList, FMX.ImgList, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdHTTP, idIOHandler,
IdIOHandlerSocket, IdIOHandlerStack, IdSSL, IdSSLOpenSSL, FMX.DateTimeCtrls,
FMX.ListBox, FMX.frxClass, FMX.frxPreview, FMX.frxDBSet, FMX.Memo,
FMX.ListView.Types, FMX.ListView.Appearances, FMX.ListView.Adapters.Base,
FMX.ListView, FMX.Ani, FMX.ExtCtrls, Data.Bind.DBScope,
FireDAC.Stan.ExprFuncs, FireDAC.Phys.SQLiteDef, FireDAC.Stan.Intf,
FireDAC.Stan.Option, FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf,
FireDAC.Stan.Def, FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys,
FireDAC.Phys.SQLite, FireDAC.Stan.Param, FireDAC.DatS, FireDAC.DApt.Intf,
FireDAC.DApt, FireDAC.FMXUI.Wait, FireDAC.Comp.UI,
FireDAC.Comp.BatchMove.DataSet, FireDAC.Comp.BatchMove,
FireDAC.Comp.BatchMove.Text, Data.DB, FireDAC.Comp.Client,
FireDAC.Comp.DataSet, FireDAC.FMXUI.Login, FMX.Platform, FMX.DialogService,
FMX.Objects, FMX.EditBox, FMX.NumberBox, FMX.Edit, FMX.ComboEdit, FMX.SpinBox, ESBDates,
FMX.frxDesgn, FMX.WebBrowser, FMX.frxCross, FMX.frxFMX, FMX.frxChart,
FMXTee.Engine, FMXTee.Series, FMXTee.Procs, FMXTee.Chart, FMX.Colors,
IPPeerServer, Datasnap.DSCommonServer, Datasnap.DSHTTP,
Datasnap.DSHTTPWebBroker;

Thanks.

Edited by: Robert Griffin on Dec 29, 2016 6:20 AM
Eli M

Posts: 1,346
Registered: 11/9/13
Re: Having problems with my first FireMonkey app  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 29, 2016 7:28 AM   in response to: Robert Griffin in response to: Robert Griffin
Apply a premium style. You will get the same look and feel on both.

docwiki.embarcadero.com/RADStudio/Berlin/en/Working_with_Native_and_Custom_FireMonkey_Styles

http://cc.embarcadero.com/item/30491

Set your TTabContol TabPosition to None (or Dots).
Robert Griffin

Posts: 97
Registered: 6/1/03
Re: Having problems with my first FireMonkey app  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 29, 2016 1:00 PM   in response to: Eli M in response to: Eli M
Eli M wrote:
Apply a premium style. You will get the same look and feel on both.

docwiki.embarcadero.com/RADStudio/Berlin/en/Working_with_Native_and_Custom_FireMonkey_Styles

http://cc.embarcadero.com/item/30491

Set your TTabContol TabPosition to None (or Dots).

Setting to Dots didn't help some of my components being hidden. Still, can't see the button on the Toolbar, but I can click it.

I applied the standard Air.Style. Boy was it ugly. Not only that, but it seemed to hide more things. I am not sure the Style is my problem or not, but I did download the premium ones and will try some of those. I just don't want my app to look like Candy. I just want it to display the controls that I drop onto FMX application and display correctly on both Windows and Mac.

I was hoping that just adding the FMX.Styles unit would help. But no matter what I drop on that toolbar on the 2nd tab of the TabView will not be displayed (although they are there, you can click them).

As far as the panel that is only visible when needed to describe something, I just created a new form for that. Looks better anyhow. But I really would like some controls on that second tab. Right now it looks like if I want a built in Browser with a toolbar, it is just not going to work for some reason.
Eli M

Posts: 1,346
Registered: 11/9/13
Re: Having problems with my first FireMonkey app  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 29, 2016 1:06 PM   in response to: Robert Griffin in response to: Robert Griffin
This is what all the premium styles look like:

www.embarcadero.com/products/rad-studio/fireui/premium-styles

What it sounds like you are experiencing to me is that you have a Windows style set and then you publish the app to Mac but no Mac style set. It will be wrong and display weird things (like what you are saying is happening).

"Drop a new TStyleBook component on your form and then set the TForm.StyleBook property to your TStyleBook component. Double click the TStyleCollection field and then add a new default TStyleCollectionItem. Double click the TStyleCollectionItem.Resource field to load the Style Designer. Add each platform to the Platform drop down in the Style Designer. Select each platform and then Open your premium style of choice for that platform. Save/Apply the style when you close it. Now you should be able to see the new Styles on each Platform preview of the form."
Robert Griffin

Posts: 97
Registered: 6/1/03
Re: Having problems with my first FireMonkey app  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 30, 2016 3:08 PM   in response to: Eli M in response to: Eli M
"Drop a new TStyleBook component on your form and then set the TForm.StyleBook property to your TStyleBook component. Double click the TStyleCollection field and then add a new default TStyleCollectionItem. Double click the TStyleCollectionItem.Resource field to load the Style Designer. Add each platform to the Platform drop down in the Style Designer. Select each platform and then Open your premium style of choice for that platform. Save/Apply the style when you close it. Now you should be able to see the new Styles on each Platform preview of the form."

I tried that and applied just the Standard Windows10.vsf and Windows10SlateGray. The download you gave said it was FMX Styles, but the only thing other than license files and readme files was a folder called 'Premium VCL Style Pack_RAD Studio Berlin', all with the extensions of .vsf. Not sure what those are.

But after applying to both Windows and OSX, My panels on the OSX view all disappeared along with my TabControl. I mean they were there, I could click on them in the IDE. But that scared me enough to back Exit the IDE without making changes. Coming from Delphi 5.0, I have a lot to catch up one. I was kicked off (can't post any more questions) StackOverflow because all of my questions were probably so rudimentary.

BTW, on this site, is there a way to be notified when you or someone else replies? I would have gotten back to you earlier.

Thanks.
Robert Griffin

Posts: 97
Registered: 6/1/03
Re: Having problems with my first FireMonkey app  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 1, 2017 10:18 AM   in response to: Robert Griffin in response to: Robert Griffin
You answer a lot for me. I just will need to work on styles a bit more. Hated all the WindowStyle. The toolbars and buttons were so big along with the fonts, and I could not change them. Maybe I can If I knew what I was doing. I will try just to apply the MacOS style and do some editing with it in the OSX Desktop view and see how that goes.

I did delete one toolbar that wasn't shown on the Mac but was showing on Windows, and then pasted it back in. I did this in the Master View. It now shows on the Mac. Maybe somehow I added that toolbar when I was in the Windows View, and that is why it wasn't showing on the Mac.

The other thinks that don't show correctly on the Mac, I just set their visible properties to true in the OnShow event.

Thanks for your help.
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: Having problems with my first FireMonkey app  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 1, 2017 10:57 AM   in response to: Robert Griffin in response to: Robert Griffin
Am 01.01.2017 um 19:18 schrieb Robert Griffin:
You answer a lot for me. I just will need to work on styles a bit more. Hated all the WindowStyle. The toolbars and buttons were so big along with the fonts, and I could not change them. Maybe I can If I knew what I was doing. I will try just to apply the MacOS style and do some editing with it in the OSX Desktop view and see how that goes.

I did delete one toolbar that wasn't shown on the Mac but was showing on Windows, and then pasted it back in. I did this in the Master View. It now shows on the Mac. Maybe somehow I added that toolbar when I was in the Windows View, and that is why it wasn't showing on the Mac.

The other thinks that don't show correctly on the Mac, I just set their visible properties to true in the OnShow event.

Hello,

afaik you can only add stuff in the master view, not in one of the
platform ones. There afaik you can only hide or delete stuff.
Maybe you deleted that unknowingly in the Mac OS X view...

Greetings

Markus
Robert Griffin

Posts: 97
Registered: 6/1/03
Re: Having problems with my first FireMonkey app  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 1, 2017 11:48 AM   in response to: Markus Humm in response to: Markus Humm
Well, maybe. It is the only reason.

I am still stumped why my FilterPanel, is weird on Mac. When I added it to the Master View initially, the OSX view didn't show it. It was there (you could see the borders), but the visibility of the panel was false. I didn't notice that until last night.

When I noticed it wasn't displaying on the Mac, my solution last month was to set the visibility to true in the OnCreate event. That seemed to work, and I also had to adjust the visibility to the controls on the panel and resize them. But it worked.

Then when I discovered visibility was set to false in the OSX Desktop view, it set it to true. It shows up now in the View. But when I run it on the Mac, it shows faded (extra faded then usual because I make it disabled until my first report finishes loading on startup. After it loads, I set the panel to enabled. When I do that, all the controls on that panel disappear.

So, I went back to my old method of making visibility false in the OSX view and setting it manually in the OnCreate Event. Works.

But now I have another problem which I know will affect my solution. For some reason, my MainForm, which gets created in the program file:
begin
  Loading := true;
  Application.Initialize;
  Application.CreateForm(TMainForm, MainForm);
  Application.CreateForm(TCatPropForm, CatPropForm);
  Application.Run;
end.

is not firing. Never seen this happen before. I have been running it all morning and then started getting access violations due to referring to things that are created in the OnCreate of my Main Form. That will also screw up my Mac visibility code. Do you know what would cause the OnCreate event not to be fired?
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: Having problems with my first FireMonkey app  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 1, 2017 11:35 PM   in response to: Robert Griffin in response to: Robert Griffin
Am 01.01.2017 um 20:48 schrieb Robert Griffin:
Well, maybe. It is the only reason.

I am still stumped why my FilterPanel, is weird on Mac. When I added it to the Master View initially, the OSX view didn't show it. It was there (you could see the borders), but the visibility of the panel was false. I didn't notice that until last night.

When I noticed it wasn't displaying on the Mac, my solution last month was to set the visibility to true in the OnCreate event. That seemed to work, and I also had to adjust the visibility to the controls on the panel and resize them. But it worked.

Then when I discovered visibility was set to false in the OSX Desktop view, it set it to true. It shows up now in the View. But when I run it on the Mac, it shows faded (extra faded then usual because I make it disabled until my first report finishes loading on startup. After it loads, I set the panel to enabled. When I do that, all the controls on that panel disappear.

So, I went back to my old method of making visibility false in the OSX view and setting it manually in the OnCreate Event. Works.

But now I have another problem which I know will affect my solution. For some reason, my MainForm, which gets created in the program file:
begin
  Loading := true;
  Application.Initialize;
  Application.CreateForm(TMainForm, MainForm);
  Application.CreateForm(TCatPropForm, CatPropForm);
  Application.Run;
end.

is not firing. Never seen this happen before. I have been running it all morning and then started getting access violations due to referring to things that are created in the OnCreate of my Main Form. That will also screw up my Mac visibility code. Do you know what would cause the OnCreate event not to be fired?

Hello,

no I don't know, but why don't you put that visibility code in the
OnShow event? Stuff should have been created at that point then.

Greetings

Markus
Robert Griffin

Posts: 97
Registered: 6/1/03
Re: Having problems with my first FireMonkey app  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 2, 2017 12:54 AM   in response to: Markus Humm in response to: Markus Humm
no I don't know, but why don't you put that visibility code in the
OnShow event? Stuff should have been created at that point then.

Thanks, but I have things in the OnCreate that needs to be created before the OnShow gets fired. But, the problem I had today just started happening. I create TStringLists in the OnCreate that are used in the OnShow, from day one. When I began to get access violations on those being nil, that is when I figured out the OnCreate wasn't firing. I think I have everything figured out on the Mac now.
Brian Hamilton ...

Posts: 556
Registered: 10/14/04
Re: Having problems with my first FireMonkey app  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 2, 2017 2:01 AM   in response to: Robert Griffin in response to: Robert Griffin
Robert Griffin wrote:
no I don't know, but why don't you put that visibility code in the
OnShow event? Stuff should have been created at that point then.

Thanks, but I have things in the OnCreate that needs to be created before the OnShow gets fired. But, the problem I had today just started happening. I create TStringLists in the OnCreate that are used in the OnShow, from day one. When I began to get access violations on those being nil, that is when I figured out the OnCreate wasn't firing. I think I have everything figured out on the Mac now.

one thing that is different on the Mac is in the oncreate, I find it best to refer to the form name variable as self instead
also if you create a form at run time, use the myform:=tmyform.create(self)

iOS and OSX load things into memory differently than windows...its managed more..depending on resources available etc..which is why it might work sometimes but not other times..the way you had it..I would suggest

Edited by: Brian Hamilton Hamilton on Jan 2, 2017 2:01 AM
Robert Griffin

Posts: 97
Registered: 6/1/03
Re: Having problems with my first FireMonkey app  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 2, 2017 8:07 AM   in response to: Brian Hamilton ... in response to: Brian Hamilton ...
one thing that is different on the Mac is in the oncreate, I find it best to refer to the form name variable as self instead
also if you create a form at run time, use the myform:=tmyform.create(self)

iOS and OSX load things into memory differently than windows...its managed more..depending on resources available etc..which is why it might work sometimes but not other times..the way you had it..I would suggest

Edited by: Brian Hamilton Hamilton on Jan 2, 2017 2:01 AM

Thanks. After today's Windows Beta I will be working on the Mac side of things. Still need my Apple cert. Figured I would work out most the bugs with my Windows users since they already know the program. Let them work out the bugs while I write the new docs. This will be my first Mac version, and so the beta testers won't know anything about the app to start with. Docs have to be in place.

It's going to be a fun week. Not going to deal with the Apple store until later this year. Just need to deploy it from my website for now as this is a tax time application.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02