That is correct, I have only ever done console programming, but now I find I'm lost trying to do any kind of GUI programming. I have a very simple program that works as a console application, but what I would like to do is have it use the Windows "Save AS' Dialog to allow the user to save the file using the windows GUI interface, so the user can navigate through directory structures and save the file.
I looked at a few tutorials and see how to make a form and put some buttons on it, but I'm still trying to figure out how to get the save-as box to come up and how to then use the given file name and path in the program for the actual write operation.. Here’s my console program.. it’s pretty simple, but I really don’t know where to even start to convert it into a GUI program. On line 51, if the output file has not been defined yet, I want to launch the save-as dialog, then on line 54, assign whatever save-as returns to my OutputFileName Variable. Program JobsList; Uses CRT,Classes,Sysutils; Var TapFileRemainder,TapFileHeader,TapFileJobsList : tstrings; TapFileName,TapFileData,OutputTapFileName : String; TapFile : Text; TapFileHeaderActive : Boolean; StringCount : LongInt; Begin If ParamStr(1)<>'' Then Begin TapFileName:=ParamStr(1); If FileExists(TapFileName) Then Begin TapFileHeaderActive:=True; Assign(TapFile,TapFileName); Reset(TapFile); TapfileHeader:=TStringlist.Create; TapfileJobsList:=TStringlist.Create; TapfileRemainder:=TStringlist.Create; While not(EOF(TapFile)) do Begin Readln(Tapfile,TapFileData); If TapfileHeaderActive then Begin If TapFileData='Call [Subroutines]' Then Begin Writeln('Subroutine Section Found'); TapFileHeaderActive:=False End Else If Copy(TapFileData,1,15)='Tap File Name =' Then Begin OutputTapFileName:=Copy(TapFileData,16,Length(TapFileData)-15); Writeln('Saving to: '+OutputTapFileName); End Else TapfileHeader.Add(TapFileData) End Else Begin If Copy(TapFileData,1,6)='[Job #' Then Begin Writeln(TapFileData); TapFileJobsList.Add('Call '+TapFileData); End; TapfileRemainder.Add(TapFileData) End; End; Close(TapFile); If OutputTapFileName='' Then Begin {Do something to get filename from windows Save-As dialog} OutputTapFileName:= Whatever-was-received-by-Windows-Save-As-dialog; End; If OutputTapFileName<>'' Then Begin Writeln('Writing ',TapFileHeader.count+TapFileJobsList.count+TapFileRemainder.count,' Lines to: '+OutputTapFileName); Assign(TapFile,OutputTapFileName); ReWrite(TapFile); If TapFileHeader.count > 1 then For StringCount:=0 to TapFileHeader.count-1 do Writeln(TapFile,TapFileHeader[StringCount]); If TapFileJobsList.count > 1 then For StringCount:=0 to TapFileJobsList.count-1 do Writeln(TapFile,TapFileJobsList[StringCount]); If TapFileRemainder.count > 1 then For StringCount:=0 to TapFileRemainder.count-1 do Writeln(TapFile,TapFileRemainder[StringCount]); Close(TapFile); End Else Begin Writeln ('No Output Tap File Specified in Program'); Readln; End; TapFileHeader.Free; TapFileJobsList.Free; TapFileRemainder.Free; End Else Begin Writeln (TapFileName,' Not Found'); Readln; End; End Else Begin Writeln ('No File Name Specified'); Readln; End; End. James -----Original Message----- From: fpc-pascal <fpc-pascal-boun...@lists.freepascal.org> On Behalf Of Tomas Hajny Sent: Friday, November 2, 2018 8:16 PM To: bo.bergl...@gmail.com; FPC-Pascal users discussions <fpc-pascal@lists.freepascal.org> Subject: Re: [fpc-pascal] Windows programming tutorials for FPC On Sat, November 3, 2018 00:00, Bo Berglund wrote: > On Fri, 2 Nov 2018 06:13:40 -0400, "James" > < <mailto:ja...@productionautomation.net> ja...@productionautomation.net> > wrote: > >>I am wondering if there are any tutorials out there, hopefully >>specific to Freepascal and/or Lazarus. >>I need really basic stuff like how to open a message box, or how to >>use windows file open, or save-as dialog boxes.. etc.. even a hello >>world tutorial would be helpful... >>ok, so ZERO windows programming experience here... Any advice on where >> to start? > > What did the programs you say you have written for so long do? > Seems hard to believe you have not encountered reading and writing > files etc. . . The original poster mentioned not having used GUI dialog boxes for file selection; I'm pretty sure reading and writing files is no problem for him. Tomas _______________________________________________ fpc-pascal maillist - <mailto:fpc-pascal@lists.freepascal.org> fpc-pascal@lists.freepascal.org <http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal