Problem with 'Cancel'

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
CAsba
Posts: 452
Joined: Fri Sep 30, 2022 12:11 pm

Problem with 'Cancel'

Post by CAsba »

Hi,
With this code...

Code: Select all

ask "Enter the description of the service."
   if the result = "Cancel " then
      exit to top
   end if
the system just moves on to the next question, disregarding the 'Cancel' input.
The code suggests what I want to happen, but it doesn't.
Any ideas, please ?
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10428
Joined: Fri Feb 19, 2010 10:17 am

Re: Problem with 'Cancel'

Post by richmond62 »

No need of "all that":

Code: Select all

on mouseUp
   put empty into fld "ff"
   ask "Enter the description of the service."
   if it is not empty then
      put it into fld "ff"
      end if
end mouseUp
-
Screen Shot 2023-05-30 at 3.08.10 pm.png
Attachments
Asker.livecode.zip
Stack.
(1011 Bytes) Downloaded 199 times
CAsba
Posts: 452
Joined: Fri Sep 30, 2022 12:11 pm

Re: Problem with 'Cancel'

Post by CAsba »

Hi, Many thanks for your kind interest, BUT
I'm afraid it didn't work. The same result as I got before, it just moved to the next question..

Other problem.
I downloaded your attachment. I couldn't run it because there is a problem I have been experiencing for some time, which is, when I click on a file, up comes a box asking what app I want to open it with, and a default "app" which is Livecode 9.69. I am using Livecode v. 10, because I had a problem with v. 9 .69, and I removed the v. 9.69 from the computer and restarted Windows, but still I am unable to open stuff because Windows annoyingly persists in offering a default access route to files with v. 9.69. Any one any ideas how I could possibly resolve this ?
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10428
Joined: Fri Feb 19, 2010 10:17 am

Re: Problem with 'Cancel'

Post by richmond62 »

Just don't click on the downloaded file, open it via the OPEN menu item in the LC version of your choice.
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10428
Joined: Fri Feb 19, 2010 10:17 am

Re: Problem with 'Cancel'

Post by richmond62 »

it just moved to the next question..
That's because you did NOT tell me there was more than one question.
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10428
Joined: Fri Feb 19, 2010 10:17 am

Re: Problem with 'Cancel'

Post by richmond62 »

Have a go with this:

Code: Select all

on mouseUp
   put empty into fld "ff"
   ask "Enter the description of the service."
   if it is empty then
      exit to top
      else
      put it into fld "ff"
   end if
   ask "Are you Happy now?"
end mouseUp
-
Screen Shot 2023-05-30 at 3.35.06 pm.png
Attachments
Asker 2.livecode.zip
Stack.
(1.02 KiB) Downloaded 201 times
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Problem with 'Cancel'

Post by Klaus »

Hi CAsba,

there is a SPACE too much in your script:

Code: Select all

...
ask "Enter the description of the service."
## if the result = "Cancel " then
    if the result = "Cancel" then
      exit to top
   end if
...
Maybe that is the problem?!

Best

Klaus
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10507
Joined: Wed May 06, 2009 2:28 pm

Re: Problem with 'Cancel'

Post by dunbarx »

Klaus nailed it.

CAsba.

LC looks at the string "Cancel " (what you wrote) as those six characters AND a space. Actually seven characters. You want the exact string "Cancel", six characters. LC simply noticed that the two strings did not match, and went from there.

Craig
CAsba
Posts: 452
Joined: Fri Sep 30, 2022 12:11 pm

Re: Problem with 'Cancel'

Post by CAsba »

Thanks Klaus ! Well spotted !!
Post Reply