BBC BASIC for Windows
Programming >> User Interface >> PROC_editbox: only works first time http://bb4w.conforums.com/index.cgi?board=ui&action=display&num=1401263028 PROC_editbox: only works first time
Post by g3nrw on May 28th, 2014, 07:43am
The PROC_editbox call works fine, but only the first time.
On subsequent calls, the text in the box is not updated.
I have tried changing the final parameter from READ_ONLY to ES_AUTOHSCROLL and then to ES_NUMBER, to see what would happen. These parameters *were* understood (I could scroll horizontally, and only enter numeric values), but still the text was not updated.
What am I doing wrong?
-- Ian Re: PROC_editbox: only works first time
Post by rtr on May 28th, 2014, 4:00pm
The PROC_editbox call works fine, but only the first time
Why would you want to create a second editbox in exactly the same position, and with exactly the same size, as the first? Although Windows will let you do that (one editbox would then obscure the other, depending on their Z-order), it seems to me a rather unusual requirement.
Quote:
On subsequent calls, the text in the box is not updated.
If the 'second' editbox is behind the first in the Z-order it will be invisible, and hence any change you make to the text it contains will not be apparent. To be able to see it you would have to change the Z-order (SetWindowPos API) so that the editbox which was 'behind' is now 'in front').
But I'm still unsure whether this is really what you are wanting to achieve. Why can't you use a single editbox and simply update the text it contains?
Richard. Re: PROC_editbox: only works first time
Post by g3nrw on May 28th, 2014, 6:10pm
But I'm still unsure whether this is really what you are wanting to achieve. Why can't you use a single editbox and simply update the text it contains? Richard.
That is exactly what I am trying to do. The box is intended to show the current status of a process, and all that is required is to update the message displayed in the box from time to time. How do I do this?
-- Ian Re: PROC_editbox: only works first time
Post by rtr on May 28th, 2014, 6:55pm
The box is intended to show the current status of a process
You will probably want to use a read-only edit box, or perhaps a simple static control, so the user cannot modify the contents. Other options may be to display the information in the title bar or a status bar.
Quote:
all that is required is to update the message displayed in the box from time to time.
That is the most basic of all operations on a dialogue box item, and indeed is the first to be described in the Initialising the contents of a dialogue box section of the BB4W Help docs:
It says: "To change the text associated with a dialogue box item (which may for example be the contents of an edit box or a label for a check box) you can use the SetDlgItemText API call":
Code:
SYS "SetDlgItemText", !dlg%, id%, text$
Of course had GUILIB been developed it would have included a BASIC wrapper function for this call.
Richard. Re: PROC_editbox: only works first time
Post by g3nrw on May 28th, 2014, 7:49pm
Another one bites the dust.
It's easy when you know how (and when you remember to read the right documentation)!