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?

Entry

BBCBASIC for Windows: GUI: Label: Operation: Create: How to: How to create a GUI label? [static]

Sep 3rd, 2006 11:46
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 03 September 2006 - 05:56 pm ------------------

BBCBASIC for Windows: GUI: Control: Label: How to create a GUI label? 
[static]

---

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

 idLabelI% = 5

 s$ = "Test"

 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%, "Cancel", idButtonCancelI%, 92, 108, 
56, 14, 0 )

 PROC_pushbutton( idBoxDialogI%, "<Set label text>", idButtonActionI%, 
12, 108, 56, 14, &20001 )

 PROC_static( idBoxDialogI%, s$, idLabelI%, 41, 40, 64, 12, 0 )

 PROC_showdialog( idBoxDialogI% )

 ON CLOSE PROC_closedialog( idBoxDialogI% ) : QUIT

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

 REPEAT

  idClickI% = 0

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

  REPEAT

   pauseI% = INKEY( 1 )

  UNTIL ( idClickI% = idButtonActionI% ) OR ( idClickI% = 
idButtonCancelI% ) OR ( !idBoxDialogI% = 0 )

  IF ( idClickI% = idButtonActionI% ) THEN

   PRINT "<Set label text> button pressed"'

   s$ = "Hello World"

   SYS "SetDlgItemText", !idBoxDialogI%, idLabelI%, s$

  ENDIF

  IF ( idClickI% = idButtonCancelI% ) THEN

   PRINT "Cancel pressed"

  ENDIF

 UNTIL ( idClickI% = idButtonCancelI% ) OR ( !idBoxDialogI% = 0 )

 ON SYS OFF

 PROC_closedialog( idBoxDialogI% )

 END

--- cut here: end ----------------------------------------------------

 2. -Run this program

 3. -When you click on the 'OK' button, it will e.g.
     change the text on the label to

      Hello World


+-------------------------+
|                         |
| <Your dialog box title> |
|                         |
+-------------------------+
|                         |
|+-<Your group box title>+|
||                       ||
||                       ||
||                       ||
||  Hello World          ||
||                       ||
||                       ||
||                       ||
||                       ||
||                       ||
||                       ||
||                       ||
|+-----------------------+|
|+-----------+            |
||<Set text> |            |
|+-----------+            |
+-------------------------+


===

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_static()')]

===

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

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