BBC BASIC for Windows
Programming >> User Interface >> How to dynamically write a label?
http://bb4w.conforums.com/index.cgi?board=ui&action=display&num=1440267599

How to dynamically write a label?
Post by g3nrw on Aug 22nd, 2015, 6:19pm

This is such a simple requirement, but I can't see how to achieve it.

CASE 1. Write a fixed label, once only.
Code:

INSTALL @lib$+"WINLIB2"

dlg%=FN_newdialog("Dialogue box", 20, 20, 160, 128, 8, 560)
PROC_checkbox(dlg%, "LABEL1", 100, 82, 82, 64, 10, 0)

PROC_showdialog(dlg%)

ON CLOSE PROC_closedialog(dlg%):QUIT
 

Here, the label "LABEL1" is written just once and never changes.
.
.
.

CASE 2. Dynamically write different labels in the same place after the dialog box is displayed:
Code:

INSTALL @lib$+"WINLIB2"

ES_READ_ONLY = &880

dlg%=FN_newdialog("Dialogue box", 20, 20, 160, 128, 8, 560)
PROC_checkbox(dlg%, "", 100, 82, 82, 64, 10, 0)

PROC_editbox(dlg%, "", 101, 99, 82, 64, 10,ES_READ_ONLY)

PROC_showdialog(dlg%)

SYS "SetDlgItemText", !dlg%, 101, "LABELaaa"
WAIT 100
SYS "SetDlgItemText", !dlg%, 101, "LABELbbb"
WAIT 100
SYS "SetDlgItemText", !dlg%, 101, "LABELccc"
WAIT 100

ON CLOSE PROC_closedialog(dlg%):QUIT
 

This works, but the bounding box around the label is visible.

Question: is there a way to implement CASE 2 such that only the label text is visible, without the ugly bounding box?

--
Ian


Re: How to dynamically write a label?
Post by g3nrw on Aug 22nd, 2015, 8:40pm

Richard has just answered this in the reflector, by saying:

"It's not obvious to me why you need the edit box at all. Doesn't changing the checkbox text directly have the effect you want? "

He is right of course. Thanks again Richard.

--
Ian