DVX_GUI/sdk/include/basic/commdlg.bas

41 lines
1.8 KiB
QBasic

' commdlg.bas -- Common Dialog Library for DVX BASIC
'
' Provides file dialogs, input dialogs, and other common UI dialogs.
' Wrappers handle the AppContextT parameter internally so BASIC
' programs just pass the visible arguments.
'
' Usage:
' '$INCLUDE: 'commdlg.bas'
'
' DIM path AS STRING
' path = basFileOpen("Open Image", "*.bmp")
' IF path <> "" THEN
' ' ... use the file ...
' END IF
DECLARE LIBRARY "basrt"
' Show a file Open dialog. Returns selected path, or "" if cancelled.
' filter$ is a DOS wildcard (e.g. "*.bmp", "*.txt").
DECLARE FUNCTION basFileOpen(BYVAL title AS STRING, BYVAL filter AS STRING) AS STRING
' Show a file Save dialog. Returns selected path, or "" if cancelled.
DECLARE FUNCTION basFileSave(BYVAL title AS STRING, BYVAL filter AS STRING) AS STRING
' Show a modal text input box. Returns entered text, or "" if cancelled.
DECLARE FUNCTION basInputBox2(BYVAL title AS STRING, BYVAL prompt AS STRING, BYVAL defaultText AS STRING) AS STRING
' Show a choice dialog with a listbox. items$ is pipe-delimited
' (e.g. "Red|Green|Blue"). Returns chosen index (0-based), or -1.
DECLARE FUNCTION basChoiceDialog(BYVAL title AS STRING, BYVAL prompt AS STRING, BYVAL items AS STRING, BYVAL defaultIdx AS INTEGER) AS INTEGER
' Show a modal integer input box with spinner. Returns the entered value.
DECLARE FUNCTION basIntInput(BYVAL title AS STRING, BYVAL prompt AS STRING, BYVAL defaultVal AS INTEGER, BYVAL minVal AS INTEGER, BYVAL maxVal AS INTEGER) AS INTEGER
' Show a "Save changes?" prompt with Yes/No/Cancel buttons.
DECLARE FUNCTION basPromptSave(BYVAL title AS STRING) AS INTEGER
END DECLARE
' Return value constants for basPromptSave
CONST DVX_SAVE_YES = 0
CONST DVX_SAVE_NO = 1
CONST DVX_SAVE_CANCEL = 2