Mega Search
23.2 Million


Sign Up

Make a donation  
$IFDEF for fast report component.  
News Group: embarcadero.public.delphi.firemonkey

Delphi XE 7.

I have adding a fastreport 2.o FMX report onto my form

When I switch to mobile I get errors.

I can fix the design time uses errors by  by 

($IF DEFINED (MSWINDOWS) }

uses FMX.frxClass

{$ENDIF}

but when I run the app on mobile it adds  FMX.frxClass to the uses and fails

Also I can work out the syntax to do the same with the type eg 

frxReport1: TfrxReport

What is the correct method for components that are not available on mobile.

Thanks

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 18-Jan-2015, at 4:32 AM EST
From: Ste War
 
Re: $IFDEF for fast report component.  
News Group: embarcadero.public.delphi.firemonkey
for example, if  you are creating a project for Android, you cannot have 
units that are not supported on that platform.

There is no FastReport yet for Android or iOS.

So when you compile for that platform you cannot have the unit declared.

For that you need to use the $IFDEF, only allowing it on the platforms that 
 you want.

What I told you is not to use one unit full of IFDEFS, instead, create a 
unit for mobile and another for the rest. 

Then you include the mobile unit when you targeting mobile..... otherwise 
use the other unit....

Only you will use FastReport on the unit that is not for mobile. 

based on what you said on your first post, you are including units that are 
not compatible, not supported on mobile. You need to pay attention to that. 
You can create the application for windows, but just trying to compile to 
another platform will not work. If you need to have reports on all the platforms 
you need to use something else, like FlexCel from TMS, since FastReports 
do not suppor all platforms.

> Hi Eduatdos,
> 
> I am not understanding the concept here.
> 
> I was presuming I could build a firemonkey app with some reports but
> 'switch off' them when running on mobile.
> 
> When I add another form to the project and then add a report component
> I still get the error
> 
> Can't resolve unit name FMX.frxClass & Undeclared Identifier
> TfrxReport.
> 
> So what is the correct procedure to do this ?
> 
> I presume I add the new form to the uses of the first form (not done
> this before I have just used a tabControl).
> 
> Then call the reports (new form) only if on windows or Mac.
> 
> Thanks....
>

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 20-Jan-2015, at 4:21 AM EST
From: Eduardo Elias
 
Re: $IFDEF for fast report component.  
News Group: embarcadero.public.delphi.firemonkey
Hi Eduatdos,

I am not understanding the concept here.

I was presuming I could build a firemonkey app with some reports but 'switch off' them when running on mobile.

When I add another form to the project and then add a report component I still get the error

Can't resolve unit name FMX.frxClass & Undeclared Identifier TfrxReport.

So what is the correct procedure to do this ?

I presume I add the new form to the uses of the first form (not done this before I have just used a tabControl).

Then call the reports (new form) only if on windows or Mac.


Thanks....

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 20-Jan-2015, at 4:04 AM EST
From: Stev Warby
 
Re: $IFDEF for fast report component.  
News Group: embarcadero.public.delphi.firemonkey
There are missing information here, I suppose you are working on a form.

If you remove the unit for fastreport and you still have references to it 
on the form the delphi IDE will automatically add the uses back again.

the correct manner in this case is that:

- having separated forms, one for windows and another for mobile. Where you 
add the propert unit using {$IFDEF} for each case
- not using fastreport as a control on the form. In this case  you create 
everything on the fly, manually, and then you can surround this code with 
{$IFDEF} to no be executed when compiled to mobile

you should not use ifdefs with forms declarations, one part of the declaration 
is in the class, but there is form stream, and that is out of reach for IFDEF.

> Delphi XE 7.
> 
> I have adding a fastreport 2.o FMX report onto my form
> 
> When I switch to mobile I get errors.
> 
> I can fix the design time uses errors by  by
> 
> ($IF DEFINED (MSWINDOWS) }
> 
> uses FMX.frxClass
> 
> {$ENDIF}
> 
> but when I run the app on mobile it adds  FMX.frxClass to the uses and
> fails
> 
> Also I can work out the syntax to do the same with the type eg
> 
> frxReport1: TfrxReport
> 
> What is the correct method for components that are not available on
> mobile.
> 
> Thanks
>

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 18-Jan-2015, at 4:54 AM EST
From: Eduardo Elias