Page 1 of 1

PostPosted: Wed Apr 18, 2007 9:18 am
by sjordi
just a very basic question while I'm evaluating OrbForms...
I have created a form on which I have a button and a label.
When I click on the button, I want to update the label text.

I set an event on the button selection as follows

handler btnCalc.onselect() {
lblResult.text = "Hello" ;

The label doesn't display "Hello".
I guess I have to invalidate it to have it redrawn. But how
do I do this?
I checkd the Draw functions, but can't get it to work.
Is there anything like a refresh() or repaint() function?

Thanks for any help.

Prangins, Switzerland

PostPosted: Wed Apr 18, 2007 9:48 am
by Rudi
Your code is right now ...
But, what is the default text in the inspector in the ide?

Your Text in the label in IDEs Inspector fpr label lab1 ist "ABC";
your code is this:
lab1.text = "Hello World";
Now the screen on the palm displays: "Hel"
Why this?
The LENGTH of Text of the label is initialisized with the default text.
If you like to write longer Textes to labels, let the default "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

Switzerland ? German ---
Das Problem ist der Default Text in der IDE (Inspector). Wenn Du hier bsp. nur "ABC" schreibst (oder schlimmer noch, gar nichts) und Du anschliessend mit lab1.text = "ABCDEFG" dann wird der Text in der L?ɬ§nge des Defaults abgeschnitten (L?ɬ§nge in Pixel).
Besser also einfach in Orbforms ein Label mit einem ordentlich langen Defaulttext belegen, z.B. "XXXXXXXXXXXXXXXXXXXXXXXXXXXX". Danach kannst Du mit label.text = "BlaBla" den Text ordentlich ver?ɬ§ndern.
Ansonsten ist Dein codebeispiel richtig so.


PostPosted: Wed Apr 18, 2007 11:43 am
by sjordi
Hi Rudi,
thanks for your help. I actually replaced the label where
I write my answer (from a calculation) with a field that
I turned as not editable, and not underlined. Then as soon
as I change it's "text" value, it's correctly updated on

Switzerland, yes, but from the French speaking part :evil:
I didn't speak Germand for 22 years though. But still can read it :)

Prangins, Switzerland

PostPosted: Wed Apr 18, 2007 3:37 pm
by FrankG
I think another visible call might behandy here too... as in:

handler btnCalc.onselect() {
lblResult.text = "Hello" ;
lblResult.visible = true;

After assigning the text, you might want to test the length of the text (See the methods for Draw objects) and adjust the button's w value. If you're shrinking the width, you might (depending on how the screen behaves) need to use a Draw rectangle method to erase the button before re-drawing it with the visible method.

Good luck,