On 11/03/2018 03:00 PM, 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.
For the simple stuff like displaying a message box or acquiring a filename, you could use the the common dialog boxes of windows (comdlg32), for example: https://docs.microsoft.com/en-us/windows/desktop/api/commdlg/nf-commdlg-getsavefilenamea I now see that this API has in fact been superseded by something different, but it should give you an idea. I do have to mention that things never stay "simple" though. Sooner rather than later you'll find yourself in a situation where you need more than just that basic functionality, and than you need to start using something different altogether (unless handling the event loop manually and fixing every last detail for every last use case of a user out there is your thing :-) ). For that purpose I would recommend the usage of some GUI toolkit: lazarus has been mentioned, similar things include fpGui and MSE, others possible exist as well. If you like to keep GUI and functionality apart from one another and have no problem with the GUI being written for a large part in a different language, have a look at Qt (possible with Qt4pas, if you insist on using pascal for the GUI). Anyway, enough on the toolkits out there, a google search will quickly yield you a lot more than I can mention in this mail :-) -- Ewald _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal