Source language: Translate to:

WhileEx and AndWhile

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

WhileEx and AndWhile

Postby Dudus » Wed Nov 08, 2017 10:10 am

Hi,

today I'm playing with While + EndWhile, but again some issues.

WhileEx "[TextEntry1]<[#32] and [TextEntry2]<[#32]"
AlertBox "Error" "Empty fileds"
Else
AlertBox "OK" "Now the code will countinue"
EndWhile
. And here starts the rest of the code


I think i do something wrong... When [TextEntry1] and [TextEntry2] are True, than the code will continue on the page, but
if Flase and they are empty than the rest of the code will not execute.

What should i change?
Thanks
D
User avatar
Dudus
 
Posts: 107
Joined: Wed Sep 07, 2005 12:15 pm
Location: Hungary, Budapest

Re: WhileEx and AndWhile

Postby Gaev » Wed Nov 08, 2017 2:37 pm

Dudus:

1) You can not use Else inside WhileEx/EndWhile ... only inside a If/Endif or IfEx/EndIf code block.

2) If you are merely trying to check contents of TextEntry boxes, you do not need to use WhileEx/WhileEnd, just place this code in the Text Change section of each of the TextEntry boxes ...
Code: Select all
GoSub "CheckForEmpty"

... and your subroutine would look like ...
Code: Select all
:CheckForEmpty
IfEx"[TextEntry1]<[#32] and [TextEntry2]<[#32]"
   AlertBox "Error" "Empty fields"
EndIf
Return


3) If you have reason to use While/EndWhile or WhileEx/EndWhile in other circumstances, you can use ExitWhile to exit the loop.
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: WhileEx and AndWhile

Postby Dudus » Thu Nov 09, 2017 2:16 am

Hi Gave,

thank you I found some other solution:

WhileEx "[TextEntry1]<[#32] or [TextEntry2]<[#32]"
AlertBox "Error" "Must be filled"
Else
EndWhile
AlertBox "Okay" "Now it's correct"

Duus
User avatar
Dudus
 
Posts: 107
Joined: Wed Sep 07, 2005 12:15 pm
Location: Hungary, Budapest

Re: WhileEx and AndWhile

Postby virger » Thu Nov 09, 2017 7:29 am

Code: Select all
WhileEx "[TextEntry1]<[#32] or [TextEntry2]<[#32]"
AlertBox "Error" "Must be filled"
Else
EndWhile
AlertBox "Okay" "Now it's correct"


ESTO NO FUNCIONA. CORRA EL PRG CON 'F9' Y OBSERVE EN EL 'DEBUGGER-ACTIONS'
THIS DOES NOT WORK. RUN THE PRG WITH 'F9' AND SEE THE 'DEBUGGER-ACTIONS'
COSTA RICA
PURA VIDA
User avatar
virger
 
Posts: 523
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 2 guests