faqts : Computers : Programming : Languages : Bbcbasic

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

1 of 2 people (50%) answered Yes
Recently 1 of 2 people (50%) answered Yes

Entry

BBCBASIC for Windows: GUI: Control: Button: How to create a GUI button?

Sep 3rd, 2006 12:02
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 02 September 2006 - 09:09 pm ------------------

BBCBASIC for Windows: GUI: Control: Button: How to create a GUI button?

---

Use WINLIB2 library
and
the PROC_pushbutton 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

 pauseI% = 0

 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_showdialog( idBoxDialogI% )

 ON CLOSE PROC_closedialog( idBoxDialogI% ) : QUIT

 ON ERROR PROC_closedialog( idBoxDialogI% ) : PRINT ' REPORT$ : END

 idClickI% = 0

 ON SYS idClickI% = @wparam% AND &FFFF : RETURN

 REPEAT pauseI% = INKEY( 1 ) : UNTIL ( idClickI% = idButtonActionI% ) 
OR ( idClickI% = idButtonCancelI% ) OR ( !idBoxDialogI% = 0 )

 ON SYS OFF

 IF ( idClickI% = idButtonActionI% ) THEN

  PRINT "<Search> button pressed"'

 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 e.g.
     show

      <Search> button pressed


+-------------------------+
|                         |
| <Your dialog box title> |
|                         |
+-------------------------+
|                         |
|+-<Your group box title>+|
||                       ||
||                       ||
||                       ||
||                       ||
||                       ||
||                       ||
||                       ||
||                       ||
||                       ||
||                       ||
||                       ||
|+-----------------------+|
|+-----------+            |
||<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' (look for 'PROC_pushbutton')]

===

Internet: see also:

---

BBCBASIC for Windows: GUI: Control: Link: Overview: Can you give an 
overview of links?
http://www.faqts.com/knowledge_base/view.phtml/aid/42206/fid/768

----------------------------------------------------------------------