[fpc-pascal] Windows programming tutorials for FPC

Ralf Quint freedos.la at gmail.com
Sat Nov 3 22:57:14 CET 2018

On 11/3/2018 1:20 PM, James wrote:
> >And you can't just pop up a dialog window without having a 
> window/form in the first place.
> That’s probably my problem…  My idea of just calling up the 
> windows-API to get the save-as dialog probably won’t work without a 
> form, even though I was able to get message boxes working
> >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.
> This logic difference is what is most confusing to me.   I just don’t 
> know where to put my main program and I don’t know how to output 
> things to some kind of text box.   I don’t want the user to do 
> anything at all unless it’s necessary… so if everything is set up 
> correctly, the program opens, does it’s thing, writes some status 
> stuff to a text box and closes,  no buttons to push or anything…. If I 
> get a GUI program to work, I guess I can put a percentage complete 
> barograph somewhere. If there’s an error, I need to stop and wait for 
> acknowledgement of the error, or if the output file was not specified, 
> I want the Save-As box to just open up on it’s own with out anyone 
> pushing any buttons, and when the save-as box is closed the process 
> completes on it’s own and the program exits without any further user 
> intervention.
I had that problem many years ago as well, having literally written 
hundreds of console of TUI based programs, mainly on DOS, myself. And 
then switching some of them to a GUI program in Delphi (there was no 
Lazarus at that time) took quite a bit of rethinking of  a couple of 
decades habits in console/command line ways or even self written TUI 
> 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
Yup, all the windows (as in GUI) stuff happens all the time, at the same 
time as your actual program. I have no had a program myself where I had 
a dialog "come up out of the blue" (as you kind of describe it), but I 
have written a lot of data conversion programs that at some point 
required to open up an additional open or save dialog. A lot though 
depends on what the actual logic behind the actual processing of your 
console program is. A lot of times, it might take a bit of re-organizing.
I am a bit short of time, as I am dealing on and off all day with some 
CERT stuff, but I will see that I take a closer look at that program 
(snippet?) that you posted later today or tomorrow morning and return a 
rough sample of a GUI "solution" for it...


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

More information about the fpc-pascal mailing list