How can I disable existing FastReport export? - delphi

I'm using C++ Builder XE7 & FastReport components. My form contains two reports (TfrxReport components) and two export components (TfrxRTFExport, TfrxPDFExport). If I preview any of those two reports I have the option to export to RTF and PDF. But, I would like to disable RTF export for the second report while still having that option for the first report. How to do it? Thanks.

Try this solution :
Remove the TfrxRTFExport component from your DataModule.
Declare your TfrxRTFExport variable.
On frxReport1Preview event , create your TfrxRTFExport.
On frxReport1ClosePreview event , Free your TfrxRTFExport.
Another solution :
If you have two button (Button 1 for the report2 , Button2 for the report1) then :
In Button 1 :
Free your TfrxRTFExport then show the report
In Button 2 :
Create your TfrxRTFExport , then show the report.

Related

How to refresh child objects in desktop testing with TestComplete

There is a desktop window, which has more tabs, and some tabs include a text editor.
The editor buttons have the following mapping on the first tab (simplified here):
Window.PageControl.Tab1.Editor.Panel.Button1
Window.PageControl.Tab1.Editor.Panel.Button2 and so on.
The editor buttons have the following mapping on the second tab (simplified here):
Window.PageControl.Tab2.Editor.Panel.Button1
Window.PageControl.Tab2.Editor.Panel.Button2 and so on.
(Sometimes the Editor and other objects between Editor and Panel are cached and their mapping is not stable.)
I wrote a test which checks the functions of the text editor in the following way:
Window.PageControl.TabIndex := 1;
editor_test;
Window.PageControl.TabIndex := 2;
editor_test;
The editor_test looks like:
Window.PageControl.Refresh;
lprops := ['FullName','WndClass'];
lvals := ['*Panel', 'TWPToolPanel'];
ltarget := Aliases.(application name).Find(lprops,lvals,20,true);
ltarget.Button1.Click;
ltarget.Button2.Click...
editor_test properly works on any single tab of the window. Although, when I try to run the editor_test more times in one test, the test fails after changing tab, because it searches the buttons on the previous tab.
I tried Refresh and RefreshMappingInfo methods on the common parent object of the tabs (see above), but they doesn't help.
(The names and number of tabs can change in the window depending on the conditions.)
Is there any other way to clear cached mapping tree during test run? Is there any mistake in the concept?
Thank you in advance for any suggestion!
The solution was to complement the editor test in the following way:
lprops := ['FullName','WndClass', 'VisibleOnScreen'];
lvals := ['*Panel', 'TWPToolPanel', true];
Using this, TestComplete does not recognize editor buttons on inactive tabs of the window, which happened in the original scenario.

Delphi - How to Register File extension for auto-open? [duplicate]

This question already has answers here:
How to associate a program with a file type, but only for the current user?
(2 answers)
Closed 8 years ago.
How can i auto-open a custom extension in my Delphi app ? I'm trying to make application
that loads text files but with a different extension.
Example : Text.DZ | all i want is when i click the file with .DZ Extension it opens my app automatically and loads the text inside into the memo1.lines.text.
I know that i have to register my new custom extension but i have no idea how to do it and
load the text into my app.
Also if you can include a source-code example that would be awesome.
Any help will be much appreciated ! and
Sorry for my newbiness and bad English explanation but i hope you guys understand me (^-^)/.
There's a way to do it programmatically, although I don't recall how off the cuff.
That said, if you're just wanting to do it for your own personal use, not for a piece of software you'll be distributing to others, then the easiest way is to use Windows Explorer: click the data file you want, then right-click and select Open With -> ... you'll probably need to select the Other... option at the bottom. That will bring up a dialog box that lets you choose your app. There should also be a checkbox somewhere that says something like "Make Default" or "Always Open With This" or something along those lines. Make sure that box is checked. Then click OK a couple of times and you're off to the races.
But you'll also need to set up your app to read the filename from the command line. You use ParamStr and ParamCount for this.
for i := 0 to ParamCount do
ShowMessage('Parameter '+IntToStr(i)+' = '+ParamStr(i));
When you double-click on the data file, it will open your app and pass this filename as ParamStr(1). So when you get it, simply do something like this:
memo1.lines.LoadFromFile( ParamStr(1) );
Use this as a STARTING POINT (it won't compile if you just copy-and-paste!):
procedure TMyForm234:FormCreate( blah blah )
begin
if ParamCount > 0 then
theMemo.Lines.LoadFromFile( ParamStr(1) );
end;

TabBar whose style can be changed dynamically based on JvTabBar

I have tried many different libraries, but none came.
None of them can not be specified without introducing his own style in Painter.
I need to be able to quickly and dynamically change the style tab.
In response, I showed my developments.
If someone has similar developments - write them in response.
I decided to upgrade the simplest of them: TJvTabBar of JVCL (latest revision: 13415)
Here is the result.
Before (default)
After
Style sources (All graphics imported from png files with transparency)
Easy apply any personal style to any JvTabBar
var tmp:TStrings;
begin
tmp:=TStringList.Create;
tmp.Values['TOP_background']:= ExtractFileDir(Application.ExeName)+'\skins\default\tabs-TOP_background.png';
tmp.Values['TOP_active_left_side']:= ExtractFileDir(Application.ExeName)+'\skins\default\tabs-TOP_active_left_side.png';
tmp.Values['TOP_active_right_side']:= ExtractFileDir(Application.ExeName)+'\skins\default\tabs-TOP_active_right_side.png';
tmp.Values['TOP_active_center']:= ExtractFileDir(Application.ExeName)+'\skins\default\tabs-TOP_active_center.png';
tmp.Values['BOTTOM_background']:= ExtractFileDir(Application.ExeName)+'\skins\default\tabs-BOTTOM_background.png';
tmp.Values['BOTTOM_active_left_side']:= ExtractFileDir(Application.ExeName)+'\skins\default\tabs-BOTTOM_active_left_side.png';
tmp.Values['BOTTOM_active_right_side']:= ExtractFileDir(Application.ExeName)+'\skins\default\tabs-BOTTOM_active_right_side.png';
tmp.Values['BOTTOM_active_center']:= ExtractFileDir(Application.ExeName)+'\skins\default\tabs-BOTTOM_active_center.png';
tmp.Values['CLOSEBUTTON_normal']:= ExtractFileDir(Application.ExeName)+'\skins\default\tabs-CLOSEBUTTON_normal.png';
tmp.Values['CLOSEBUTTON_selected']:= ExtractFileDir(Application.ExeName)+'\skins\default\tabs-CLOSEBUTTON_selected.png';
tmp.Values['CLOSEBUTTON_disabled']:= ExtractFileDir(Application.ExeName)+'\skins\default\tabs-CLOSEBUTTON_disabled.png';
tmp.Values['CLOSEBUTTON_closing']:= ExtractFileDir(Application.ExeName)+'\skins\default\tabs-CLOSEBUTTON_closing.png';
tmp.Values['CLOSEBUTTON_modified']:= ExtractFileDir(Application.ExeName)+'\skins\default\tabs-CLOSEBUTTON_modified.png';
tmp.Values['CLOSEBUTTON_closing_modified']:= ExtractFileDir(Application.ExeName)+'\skins\default\tabs-CLOSEBUTTON_closing_modified.png';
JvTabBar1.StyleImages:=tmp;
tmp.Values['BOTTOM_background']:= ExtractFileDir(Application.ExeName)+'\skins\default\MYMOD_tabs-BOTTOM_background.png';
JvTabBar2.StyleImages:=tmp;
Main changes
Added ability to specify their own style ( JvTabBar1.StyleImages )
Added the ability to move the close button to the right ( JvTabBar1.CloseButtonRight: = true or false )
Many fixes to the size and position of text / icons / buttons / scroll
My JvTabBar.pas mod You can download it here http://pastebin.com/JmbufHy0
And example source style + JvTabBar.pas http://www.sendspace.com/file/shhuzr

Set Hyperlink into iReport

I used Jaspersoft iReport Designer 5.1.0 in ubntu 12.04
I want create Hyperlink.
Two Report :- Report 1
Report 2
In Report 1 set Hyperlink To called Report 2
Step :-
Take on text element ex : ${ID}
Right Click Hyperlink
Target : self type : Report Execution
Link Parameter :- _report "/path Report2"
In Preview Click Id than nothing happen and Report 2 not called
And Following Error Occurred:-
 
Compiling to file... /home/mansi/Tweet_Report/report5.jasper
Compilation running time: 174!
 Filling report...
 Locale: English (India)  Time zone: Default Report fill running
time: 44! (pages generated: 1)  Exporting Text (iReport) to file...
/home/abc/R1_Report/Report1.txt!
Error exporting print... net.sf.jasperreports.engine.JRPrintText.getTextAlignment()B
java.lang.NoSuchMethodError: net.sf.jasperreports.engine.JRPrintText.getTextAlignment()B
    at com.jaspersoft.jrx.export.JRTxtExporter.layoutGrid(JRTxtExporter.java:419)
    at com.jaspersoft.jrx.export.JRTxtExporter.exportPage(JRTxtExporter.java:300)
    at com.jaspersoft.jrx.export.JRTxtExporter.exportReportToWriter(JRTxtExporter.java:289)
    at com.jaspersoft.jrx.export.JRTxtExporter.exportReport(JRTxtExporter.java:257)
    at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:1174)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)
    at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)
Export running time: 9! No external viewer specified for this type of
print. Set it in the options frame!
Please help me to solved this Error.
http://community.jaspersoft.com/questions/803963/outputing-txt-file
It looks like you have to set the character height and width. From the page I have linked to:
Go to Tools-->Options
Select Export Options tab --> Select Text from left pane
Set values for Character Width, Character Height, (The values I have set 7 and 13.9) Page width and Height.
Now try generating the report and it will work. Try setting different values to make it fit properly.

Delphi: EReadError with message 'Property Persistence does Not Exist'

My program written with Delphi 7 compiles OK, but when I run it it gives me the error message:
Project1.Exe raised exception class EReadError with Message 'Property Persistence does Not Exist'. Process Stopped.
This only started after I installed the TMS Component Pack to use with this project. Thanks for any help.
Open the Form in Delphi IDE
Use Alt + F12 to edit the .DFM source
Search the "Persistence" property
Delete the line with "Persistence" property
DFM example:
SomeComponent1 = TSomeComponent
OtherProperty = OtherValue
Persistence = True
AnotherProperty = AnotherValue
end
Also you can use the great DFMCheck 1.4 tool, by Andreas Hausladen. To check any other missing property like that:
http://andy.jgknet.de/blog/?page_id=177
This is most likely caused by the compiled & installed package being out of sync with the actual .pas file. If you have source code then rebuilding the packages will probably fix it.
Set a breakpoint(F5) and step the program(F7/F8).Get to the location where you get that exception and then give us more information about it(show some code).
This error means that it's trying to load something (usually a form) from a DFM resource and it comes up with a value for a property that the component it's creating doesn't have.
If it only happened when you started using TMS components, the solution is simple: don't use them. Send as much information as you can about the error and the project that caused it to the authors and see if they can find a way to fix it. Until then, use something else.
If you're using text DFMs (right click on the form, check "Text DFM", save), you can use Search|Find in Files to find all instances of Persistence in your DFM files. Just set the search string to "Persistence" (I usually tell it to ignore case), the file mask to "*.dfm", and check the "All files in project" checkbox.
If you're not already using text DFMs and don't want to manually open all forms and check the box and then resave them, you can use CONVERT.EXE (in the ($DELPHI)\Bin folder) to convert them en-masse. Run CONVERT with no parameters from any command prompt to see the options. By default, CONVERT will save .DFM as .txt, but you can have it work in-place (rewriting the binary .DFM as the text .DFM) by using the -i switch. (I usually back up the .DFMs to a different folder first, then convert them. If no errors are reported, I can then delete the backed up .DFMs later.)
I had similar problem with TMS when I upgraded to a new version:
If you think that some particular component is causing the problem,
delete it , compile project without it, place it on the form/frame again.
If that doesn't work for you:
Things you need to do in order to fix the problem , so you can use Designer and new properties, because that's what you really want , don't you ? :-) :
Uninstall TMS Component Pack ( or whatever you're using )
Re-Install TMS Component Pack
Build & Install the packages
Add appropriate TMS .lib files to your Application Project ( I'm using C++ Builder )
Add appropriate TMS .pas files to your Application Project . For example I had a problem with TAdvSmoothCalendar component , so I've added the AdvSmoothCalender.pas to my project.
Cheers!
I hope it works for everyone with a similar problem :)
I had similar problem with nuiGui Delphi Framework,
To Solve this, create a include file with some properties and use it in your class.
/// include class 'Basic.inc'
private
function GetWidth: Integer;
published
property ClientHeight : Integer Read FHeight Write FHeight;
//property ClientWidth : Integer Read FWidth Write FWidth;
//property OldCreateOrder : Boolean Read FOldCreateOrder Write FOldCreateOrder;
end;
...
/// main class like this
TuMemoFrame = class(TUniFrame)
UniMemo1: TUniMemo;
UniMemo2: TUniMemo;
UniButton1: TUniButton;
procedure UniButton1Click(Sender: TObject);
private
public
{$Include Basic.inc } // <---
end;

Resources