Entry
BBCBASIC for Windows: GUI: Text edit box: Operation: Create: How to create a GUI text edit box?
Sep 3rd, 2006 10:14
Knud van Eeden,
----------------------------------------------------------------------
--- Knud van Eeden --- 04 February 2021 - 06:13 pm -------------------
BBCBASIC for Windows: GUI: Text edit box: Operation: Create: How to
create a GUI text edit box?
---
Use WINLIB2 library and the PROC_editbox() procedure.
---
Steps: Overview:
1. -Create the following program
--- cut here: begin --------------------------------------------------
HIMEM = PAGE + 5000
INSTALL @lib$ + "WINLIB2"
idClickI% = 0
idBoxDialogI% = 1
idBoxGroupI% = 2
idButtonActionI% = 3
idButtonCancelI% = 4
idBoxEditI% = 5
idBoxDialogI% = FN_newdialog( "<Your dialog box title>", 20, 20, 160,
128, 8, 504 )
PROC_groupbox( idBoxDialogI%, "<Your group box title>", idBoxGroupI%,
4, 4, 152, 96, &20000 )
PROC_pushbutton( idBoxDialogI%, "<Search>", idButtonActionI%, 12,
108, 56, 14, &20001 )
PROC_pushbutton( idBoxDialogI%, "Cancel", idButtonCancelI%, 92, 108,
56, 14, 0 )
PROC_editbox( idBoxDialogI%, "<Your search string>", idBoxEditI%, 12,
20, 64, 12, &80 )
PROC_showdialog( idBoxDialogI% )
ON CLOSE PROC_closedialog( idBoxDialogI% ) : QUIT
ON ERROR PROC_closedialog( idBoxDialogI% ) : PRINT ' REPORT$ : END
ON SYS idClickI% = @wparam% AND &FFFF : RETURN
REPEAT pause% = INKEY( 1 ) : UNTIL ( idClickI% = idButtonActionI% )
OR ( idClickI% = idButtonCancelI% ) OR ( !idBoxDialogI% = 0 )
ON SYS OFF
IF ( idClickI% = idButtonActionI% ) THEN
PRINT "'Search' pressed, settings were : "'
DIM text% 100
SYS "GetDlgItemText", !idBoxDialogI%, idBoxEditI%, text%, 100 TO Len%
text%?Len% = 13
PRINT "Text box contained """$text%""""
ELSE
PRINT "Cancel pressed"
ENDIF
PROC_closedialog( idBoxDialogI% )
END
--- cut here: end ----------------------------------------------------
2. -Run this program
3. -When you click on the 'OK' button, it will return the text you
typed
1. -E.g.
test
+-------------------------+
| |
| <Your dialog box title> |
| |
+-------------------------+
| |
|+-<Your group box title>+|
|| ||
|| +------------------+ ||
|| | | ||
|| |<My search string>| ||
|| +------------------+ ||
|| ||
|| ||
|| ||
|| ||
|| ||
|| ||
|+-----------------------+|
|+-----------+ |
||<Search> | |
|+-----------+ |
+-------------------------+
===
File: see also:
[file: 'dlgdemo.bbc' in the 'BBC BASIC for Windows' directory]
===
Help: see also:
[help: program: BBCBASIC for Windows v5.00a or higher: search
for 'Dialogue boxes']
===
Internet: see also:
---
----------------------------------------------------------------------