|
- Forum
- iziBasic
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 257
Topic # 1174 |
Why does this code make my Palm freeze? |
17/03/2005 @ 22:20 by Joshua Cook

|
I am attempting to write a routine that will right justify a text field. It works to a point. I am wondering if anyone could take a look at it and tell me why it freezes my Palm when I erase the last character from the text field? I am sure it is something obvious, but I am not seeing it.
Here is the code. Please don't laugh. I am still learning! <img src="http://www.aldweb.com/inc/img/smileys/biggrin.gif">
' Spacetest.ibas {creatorid "LDIk"} {version "1.0"} {parser on}
BEGIN dim %textwidth%, %space$, %fieldwidth% dim %fieldnum%,%spacewidth%,%fontnum% dim %numspaces%, %curfieldval$, %oldfieldval$ %fontnum%=0 %spacewidth%=fontwidth(" ",%fontnum%) %fieldwidth%=28 textfield #1,"1000",0,105,40,%fieldwidth%,14 label #2,"",105,70 %fieldnum%=1 : gosub _rightjustify repeat e=doevents %fieldnum%=1: gosub _rightjustify 'w=0.25:gosub _wait until e=-1 END
_rightjustify: {parser on} %curfieldval$=field$(#%fieldnum%) if %oldfieldval$="" then 'print "old before is ": print %oldfieldval$ %curfieldval$=trim$(%curfieldval$) %oldfieldval$=%curfieldval$ 'print "old after is " : print %oldfieldval$ end if
%oldfieldval$=trim$(%oldfieldval$) %curfieldval$=trim$(%curfieldval$) 'print % if %oldfieldval$=%curfieldval$ then 'print "nothing to do!" else %textwidth%=fontwidth(%curfieldval$,0) updatelabel #2,%curfieldval$ if %curfieldval$="" then flushevents print "equals nothing" else %numspaces%=(%fieldwidth%-%textwidth%)/%spacewidth% %space$=space$(%numspaces%) %curfieldval$=%space$+%curfieldval$ updatefield #%fieldnum%,%curfieldval$ '%curfieldval$="'"+%curfieldval$+"'" 'print %curfieldval$ show #%fieldnum% %curfieldval$=field$(#%fieldnum%) %curfieldval$=trim$(%curfieldval$) %oldfieldval$=%curfieldval$ end if end if return
_wait: t=tickspersec*w u=ticks do v=ticks-u loop v=t return |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 1 -------- 19/03/2005 @ 11:31 by aldweb

visitor |
Joshua,
It does not freeze in the Palm Emulator. It just keeps sending me a "equals nothing" message. But I can still try to erase a few more times (to make sure I really erased the last character), then once I input a new character, it does get it. And I can still exit normally from the program whenever I want.
Did I miss something?
Cheers,
@+ aldweb |
|
 |
 topic active
 topic closed
 Sticky
 New message -
 Correct message
 Close topic
 Make sticky
|
|