Page 1 of 1

WhileEx and AndWhile

PostPosted: Wed Nov 08, 2017 10:10 am
by Dudus
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

Re: WhileEx and AndWhile

PostPosted: Wed Nov 08, 2017 2:37 pm
by Gaev
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.

Re: WhileEx and AndWhile

PostPosted: Thu Nov 09, 2017 2:16 am
by Dudus
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

Re: WhileEx and AndWhile

PostPosted: Thu Nov 09, 2017 7:29 am
by virger
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'