First post - ParamStr?

Please post bug reports, feature requests, or any question regarding the DELPHI AREA projects here.

First post - ParamStr?

Postby georgen » September 16th, 2016, 3:20 pm

I've just begun working with PrintPreview.

In the General Demo, the Create method calls "...if (ParamCount > 0) and FileExists(ParamStr(1)) then..."

What component or unit's properties are the potential source(s) for "ParamCount" and "ParamStr(1)?

My first guess was "TPageSetupDialog" but I don't see those properties for that component, or its ancestors (?)

Also, I don't find uses of those terms in the "Preview.pas" unit.

Stepping through that Demo Create method, I see that that
<
if (ParamCount > 0) and FileExists(ParamStr(1)) then
RichEdit1.Lines.LoadFromFile(ParamStr(1))
>
is not used...

And I'm not familiar with the use of those arguments (?unless maybe from use of the command line?) but I don't see
references for that type of use in the demo or in the source for "Preview.pas".

George
georgen
Member
Member
 
Posts: 3
Joined: September 16th, 2016, 2:19 pm

Re: First post - ParamStr?

Postby georgen » September 17th, 2016, 12:51 am

Ok, I found a page that has some potential content about Paramcount and Paramstr. XE2 "help" was, for me, obtuse.

This link provides a beginning explanation that I can understand: http://www.delphibasics.co.uk/RTL.asp?Name=ParamCount

However, I don't understand why the General Demo was designed to first consider command line input.

If there is some literature or programming philosophy or a chapter in one of the Delphi books that digs into that, I'd be grateful.

George
georgen
Member
Member
 
Posts: 3
Joined: September 16th, 2016, 2:19 pm

Re: First post - ParamStr?

Postby Kambiz » September 18th, 2016, 10:34 am

Hi there,

The command line parameter has nothing to do with the preview component. It's the part of sample program.

By default, the demo uses TEAMWORK.rtf file as the rich text sample. Drag another .rtf file and drop it on Genral.exe to see why there is a command line parameter.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: First post - ParamStr?

Postby georgen » September 18th, 2016, 8:58 pm

Kambiz,

Thanks for your reply. Your offerings are gifts I appreciate.

I did not think that the command line parameters were an essential/part of the printpreview component, but rather part of how the General Demo was designed; additional functionality.

I can see that the Create method loads the TEAMWORK.rtf, but then the Activate event appears to replace that file " before it appears, by the calls within the GeneratePages method.

I am steadily learning about the conceptualizations involved with your TPrintPreview, and I believe it will be valuable to my work.

As far as "dragging" a file onto the General Demo, I can't find a way to make GD stay on top unless it is alone, and directly on top of the Desktop.

So, I have tried copying an .rtf file from my file manager, but I can find no way to effectively "paste" it.

The only thing I can understand to "drag" onto the GD is a shortcut to that .rtf file I've placed on the Desktop, and that only results in the mouse cursor reverting to the "no go" circle with the diagonal line cursor.

BUT... even though I can't get it to work as you suggest, your reply gives me a basic understanding of what you intend by the purpose/functionality of using those Param calls in the Create method.

So I am learning nevertheless. Thank you.

George
georgen
Member
Member
 
Posts: 3
Joined: September 16th, 2016, 2:19 pm

Re: First post - ParamStr?

Postby Kambiz » September 21st, 2016, 10:40 am

The preview demo has no code to support drag & drop or copy & paste.

The command line parameter was solely for making it easier for testing the component with various RTF content.

FileDragDrop.png
FileDragDrop.png (16.13 KiB) Viewed 2607 times
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm


Return to DELPHI AREA Projects

Who is online

Users browsing this forum: No registered users and 22 guests

cron