<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{mso-style-priority:99;
mso-style-link:"Plain Text Char";
margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.PlainTextChar
{mso-style-name:"Plain Text Char";
mso-style-priority:99;
mso-style-link:"Plain Text";
font-family:"Calibri",sans-serif;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoPlainText>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.<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>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. <o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText><span style='font-family:Consolas'>Program JobsList;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'>Uses CRT,Classes,Sysutils;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'>Var<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> TapFileRemainder,TapFileHeader,TapFileJobsList : tstrings;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> TapFileName,TapFileData,OutputTapFileName : String;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> TapFile : Text;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> TapFileHeaderActive : Boolean;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> StringCount : LongInt;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'>Begin<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> If ParamStr(1)<>'' Then<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Begin<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> TapFileName:=ParamStr(1);<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> If FileExists(TapFileName) Then<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Begin<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> TapFileHeaderActive:=True;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Assign(TapFile,TapFileName);<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Reset(TapFile);<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> TapfileHeader:=TStringlist.Create;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> TapfileJobsList:=TStringlist.Create;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> TapfileRemainder:=TStringlist.Create;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> While not(EOF(TapFile)) do<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Begin<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Readln(Tapfile,TapFileData);<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> If TapfileHeaderActive then<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Begin<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> If TapFileData='Call [Subroutines]' Then<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Begin<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Writeln('Subroutine Section Found');<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> TapFileHeaderActive:=False<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> End<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Else<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> If Copy(TapFileData,1,15)='Tap File Name =' Then<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Begin<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> OutputTapFileName:=Copy(TapFileData,16,Length(TapFileData)-15);<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Writeln('Saving to: '+OutputTapFileName);<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> End<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Else<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> TapfileHeader.Add(TapFileData)<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> End<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Else<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Begin<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> If Copy(TapFileData,1,6)='[Job #' Then<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Begin<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Writeln(TapFileData);<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> TapFileJobsList.Add('Call '+TapFileData);<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> End;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> TapfileRemainder.Add(TapFileData)<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> End;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> End;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Close(TapFile);<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> If OutputTapFileName='' Then<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Begin<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas;color:red'> {Do something to get filename from windows Save-As dialog}<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas;color:red'> OutputTapFileName:= Whatever-was-received-by-Windows-Save-As-dialog;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> End;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> If OutputTapFileName<>'' Then<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Begin<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Writeln('Writing ',TapFileHeader.count+TapFileJobsList.count+TapFileRemainder.count,' Lines to: '+OutputTapFileName);<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Assign(TapFile,OutputTapFileName);<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> ReWrite(TapFile);<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> If TapFileHeader.count > 1 then<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> For StringCount:=0 to TapFileHeader.count-1 do<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Writeln(TapFile,TapFileHeader[StringCount]);<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> If TapFileJobsList.count > 1 then<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> For StringCount:=0 to TapFileJobsList.count-1 do<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Writeln(TapFile,TapFileJobsList[StringCount]);<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> If TapFileRemainder.count > 1 then<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> For StringCount:=0 to TapFileRemainder.count-1 do<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Writeln(TapFile,TapFileRemainder[StringCount]);<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Close(TapFile);<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> End<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Else<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Begin<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Writeln ('No Output Tap File Specified in Program');<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Readln;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> End;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> TapFileHeader.Free;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> TapFileJobsList.Free;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> TapFileRemainder.Free;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> End<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Else<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Begin<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Writeln (TapFileName,' Not Found');<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Readln;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> End;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> End<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Else<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Begin<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Writeln ('No File Name Specified');<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> Readln;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'> End;<o:p></o:p></span></p><p class=MsoPlainText><span style='font-family:Consolas'>End.<o:p></o:p></span></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>James<o:p></o:p></p><p class=MsoPlainText>-----Original Message-----<br>From: fpc-pascal <fpc-pascal-bounces@lists.freepascal.org> On Behalf Of Tomas Hajny<br>Sent: Friday, November 2, 2018 8:16 PM<br>To: bo.berglund@gmail.com; FPC-Pascal users discussions <fpc-pascal@lists.freepascal.org><br>Subject: Re: [fpc-pascal] Windows programming tutorials for FPC</p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>On Sat, November 3, 2018 00:00, Bo Berglund wrote:<o:p></o:p></p><p class=MsoPlainText>> On Fri, 2 Nov 2018 06:13:40 -0400, "James"<o:p></o:p></p><p class=MsoPlainText>> <<a href="mailto:james@productionautomation.net"><span style='text-decoration:none'>james@productionautomation.net</span></a>> wrote:<o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>>>I am wondering if there are any tutorials out there, hopefully <o:p></o:p></p><p class=MsoPlainText>>>specific to Freepascal and/or Lazarus.<o:p></o:p></p><p class=MsoPlainText>>>I need really basic stuff like how to open a message box, or how to <o:p></o:p></p><p class=MsoPlainText>>>use windows file open, or save-as dialog boxes.. etc.. even a hello <o:p></o:p></p><p class=MsoPlainText>>>world tutorial would be helpful...<o:p></o:p></p><p class=MsoPlainText>>>ok, so ZERO windows programming experience here... Any advice on where<o:p></o:p></p><p class=MsoPlainText>>> to start?<o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>> What did the programs you say you have written for so long do?<o:p></o:p></p><p class=MsoPlainText>> Seems hard to believe you have not encountered reading and writing <o:p></o:p></p><p class=MsoPlainText>> files etc.<o:p></o:p></p><p class=MsoPlainText> .<o:p></o:p></p><p class=MsoPlainText> .<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>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.<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>Tomas<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>_______________________________________________<o:p></o:p></p><p class=MsoPlainText>fpc-pascal maillist - <a href="mailto:fpc-pascal@lists.freepascal.org"><span style='text-decoration:none'>fpc-pascal@lists.freepascal.org</span></a> <a href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal"><span style='text-decoration:none'>http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</span></a><o:p></o:p></p></div></body></html>