[fpc-pascal] Windows programming tutorials for FPC

James james at productionautomation.net
Sat Nov 3 23:04:29 CET 2018


Thanks for the suggestion... 

I put my code in the OnCreate event as you suggested, but when I try to compile it, I get wrong number of parameters specified for call to Assign... my code worked before, and I have no idea what other parameters it could want or why it would be any different than my console application.

I'm doing:
Var  
   TapFileName : AnsiString;
   TapFile  : Text;

Assign(TapFile,TapFileName);

Any ideas why this works in FPC but not in Lazarus?

James

-----Original Message-----
From: fpc-pascal <fpc-pascal-bounces at lists.freepascal.org> On Behalf Of Luca Olivetti
Sent: Saturday, November 3, 2018 4:47 PM
To: fpc-pascal at lists.freepascal.org
Subject: Re: [fpc-pascal] Windows programming tutorials for FPC

El 3/11/18 a les 21:20, James ha escrit:

> 
> I’ve been tinkering with Lazarus, and I managed to get a form with 
> some buttons based on the examples, and I did make one button open the 
> save-as box… but I’m clueless on how to make the save-as box only come 
> up when needed and by a programming command, not because someone 
> pushed a button.  I still can’t figure out how to write my writeln’s 
> into a text box of some sort.    I get the idea… instead of a 
> sequential program the executes from beginning to end,  everything 
> kind of all happens at the same time


Try this:

-put a memo on the form (say, memo1) and a save dialog.
-in the object inspector double click on the OnCreate event of the form.
-this will create a FormCreate method. Put your code there (including the opening of the save dialog if needed).
-in your code show diagnostics messages in the memo
(mem1.lines.add('whatever'))
-at the end of your code, if everything is OK, add

     Application.ShowMainForm:=false;
     Application.Terminate;


This way, if there are no errors the form won't show, otherwise it will show whatever you put in the memo.

Tip: if your code will take a significant amount of time put at the beginning

Screen.Cursor:=crHourGlass;

and at the end

Screen.Cursor:=crDefault;


Bye
--
Luca
_______________________________________________
fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal



More information about the fpc-pascal mailing list