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: FourthWorld, heatherlaine, Klaus, kevinmiller

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

Problem with 'Cancel'

Post by CAsba » Tue May 30, 2023 12:47 pm

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: 9359
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Problem with 'Cancel'

Post by richmond62 » Tue May 30, 2023 1:09 pm

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 55 times

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

Re: Problem with 'Cancel'

Post by CAsba » Tue May 30, 2023 1:26 pm

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: 9359
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Problem with 'Cancel'

Post by richmond62 » Tue May 30, 2023 1:31 pm

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: 9359
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Problem with 'Cancel'

Post by richmond62 » Tue May 30, 2023 1:33 pm

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: 9359
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Problem with 'Cancel'

Post by richmond62 » Tue May 30, 2023 1:36 pm

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 58 times

Klaus
Posts: 13824
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Problem with 'Cancel'

Post by Klaus » Tue May 30, 2023 1:43 pm

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: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Problem with 'Cancel'

Post by dunbarx » Tue May 30, 2023 2:25 pm

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: 363
Joined: Fri Sep 30, 2022 12:11 pm

Re: Problem with 'Cancel'

Post by CAsba » Tue May 30, 2023 4:24 pm

Thanks Klaus ! Well spotted !!

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”