Page 1 of 1

Test for an empty TextEntry ?

PostPosted: Thu Dec 18, 2014 9:58 pm
by TMcD
How do you test for a TextEntry object being empty or not?

I tried:

Code: Select all
If "[ITM]" "<>" ""
  . If it's not empty do this
  . [ITM] String stuff goes here
EndIf


But NeoBook tells me that line 1,"I don't understand this command!"

I guess it is looking to work with numbers but I thought if ITM was not empty or was empty I could use the "If" as I have it... ??

Re: Test for an empty TextEntry ?

PostPosted: Fri Dec 19, 2014 5:29 am
by mishem
TMcD wrote:But NeoBook tells me that line 1,"I don't understand this command!"



Code: Select all
If "[ITM]" "<>" ""
    SubStr "[ITM]" "1" "1" "[Show]"
    If "[Show]" "=" "[#32]"
        SetVar "[Show]" "#32"
    EndIf
    If "[Show]" "=" "[#152]"
        SetVar "[Show]" "#152"
    EndIf
    If "[Show]" "=" "[#10]"
        SetVar "[Show]" "#10"
    EndIf
    If "[Show]" "=" "[#13]"
        SetVar "[Show]" "#13"
    EndIf
    AlertBox "" "[Show]"
EndIf


There are characters that you can not see. But they are.
Accordingly, the variable is not empty.

Re: Test for an empty TextEntry ?

PostPosted: Fri Dec 19, 2014 7:06 am
by Gaev
TMcD:

But NeoBook tells me that line 1,"I don't understand this command!"

Assuming that the If command was the first one in the code section, I think that it might be treating the whole If/EndIf code block as Line 1 ... and the erroneous command might be one of the commands that was not posted here.

Try this first ...
Code: Select all
SetVar "[abc]" "123"
If "[abc]" "=" ""
   AlertBox "abc" "is empty"
EndIf
AlertBox "The" "End"

If that works ... and it should ... try ...
Code: Select all
SetVar "[abc]" "123"
If "[abc]" "<>" ""
   AlertBox "abc" "is not empty"
EndIf
AlertBox "The" "End"


Then, replace [abc] with [ITM] ... if that does not produce the error message, it definitely has to do with some code between the If/EndIf block.

Re: Test for an empty TextEntry ?

PostPosted: Fri Dec 19, 2014 7:51 am
by mishem
I probably did not understand the question?
:)