Post by georgemcginn on Jun 18, 2021 20:18:52 GMT -5
I use Zenity in several programming languages on Linux, and I have a working version for FreeBASIC on my Linux Distro.
To use the code in this post, you first need to install Zenity. Zenity is a simple GUI system written by the GNOME Project. It is designed to allow the use of GTK dialog boxes in command line and shell scripts, and with the SHELL statement, you can execute Zenity commands from your FreeBASIC program.
The code creates a form that asks for your first and last names, email address, and displays a calendar to allow you to input your birthday (or any date). I creates a pipe-delimited file named addr.,txt, and it puts the date out as 20+YYMMDD. If you remove the --forms-date-format, it will write out MM/DD/YY.
The documentation is sparse for this, but what is written can be found at: Zenity User Manual
This is only available on Linux. From what I can see, Zenity does not exist on Windows or macOS.
DIM AS INTEGER result
result = SHELL ("zenity --forms --title=" + CHR$(34) + "Add Friend" + CHR$(34) + _
" --text=" + CHR$(34) + "Enter information about your friend." + CHR$(34) + _
" --add-entry=" + CHR$(34) + "First Name" + CHR$(34) + _
" --add-entry=" + CHR$(34) + "Last Name" + CHR$(34) + _
" --add-entry=" + CHR$(34) + "Email" + CHR$(34) + _
" --add-calendar=" + CHR$(34) + "Birthday" + CHR$(34) + _
" --forms-date-format=20%y%m%d >> addr.txt" _
)
IF result <> 0 THEN
result = SHELL("zenity --error --text=" + CHR$(34) + "Error detected in executing Zenity Forms." + CHR$(34))
END IF
Here is what the form looks like: