Page 1 of 1

Load EULA dynamically?

Posted: Tue Feb 06, 2007 8:25 pm
by AndrewC
In the User Interface section, I see a way I can statically enter EULA text, but what I'd like to do is load that dynamically from a file. How can I do that?

Posted: Wed Feb 07, 2007 1:37 am
by CandiceJones
You can set the receives information field for the control to nothing, set the lines property to a variable, and then use Read from Text File to populate that variable at runtime.

Posted: Thu Feb 15, 2007 10:11 pm
by AndrewC
I'm doing something wrong but I am not sure what. In the Form designer's Define Interactive Characteristics dialog, Object Behavior tab, I set RichEdit1's Receive Information combo to <none>. In script, I read RTF text from a file into a variable named LICENSETEXT. I can put a label on the dialog and set the label's caption to $LICENSETEXT, and that works fine, but I haven't found a way to successfully load RichEdit1.Lines.

I've tried using Object Rules tab in the Define Interactive Characteristics dialog, adding the rule: "If (RichEdit1.Visible = True) THEN RichEdit1.Lines := $LICENSETEXT$;". I've also tried "If (RichEdit1.Visible = True) THEN RichEdit1.Lines := LicenseLabel.Caption;" where LicenseLabel is the hidden label on the dialog that has its caption set to $LICENSETEXT$.

It compiles fine, but at runtime it gets 'Invalid property value'. So what's the trick of loading a RichEdit's Lines property?

Posted: Fri Feb 16, 2007 8:02 am
by CandiceJones
Did you click the "..." button in the Lines property of the Object Properties window for the richedit control? That would be the correct approach for what you are trying to do.

Posted: Fri Feb 16, 2007 7:35 pm
by AndrewC
I assume you are saying I should set the Lines property to $LICENSETEXT$ so it'll load the contents of that variable? When I tried that, I got "RichEdit line insertion error".

When I tried loading LICENSETEXT with plain text instead of RTF, I don't get an error at runtime, but all I get is the first line of the license file. Is there some property that controls adding multiple lines that I'm missing? I have maxlength set to 0.

Posted: Sun Feb 18, 2007 4:16 pm
by CandiceJones
How did you try to read in the RTF file? Sounds like you tried to read in a formatted file and that naturally caused an error. Read from Text File works well with plain text files, but might not fare so well with files containing binary data. Also it has a switch to enable reading in an entire file - so you don't have to code a loop for it. Just press F1 for the switch syntax while the window is showing.

You can also call CopyFileA or MoveFileA in kernel32.dll through Call DLL Function, renaming one of your multiple possible license files to the form InstallAware expects them in at runtime.