[fpc-pascal] Windows programming tutorials for FPC

Ralf Quint freedos.la at gmail.com
Sat Nov 3 20:52:25 CET 2018


On 11/3/2018 7:00 AM, James wrote:
>
> 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.
>
The main thing to keep in mind that the main program loop in a GUI 
program is to handle all the (internal) GUI stuff, not your console 
program loop. A RAD tool like Lazarus, will conveniently handle that for 
you.

And you can't just pop up a dialog window without having a window/form 
in the first place.

In general, the logic of a GUI based program (regardless if Windows, 
macOS, Linux, etc) simply is different from a console program. Your 
console program main loop simply  pretty much just becomes a procedure 
within the GUI main loop.

Ralf



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20181103/ef4318f7/attachment.html>


More information about the fpc-pascal mailing list