Having a problem with the "ask" dialog

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
stuartls
Posts: 49
Joined: Mon Jan 22, 2007 10:59 pm
Contact:

Having a problem with the "ask" dialog

Post by stuartls » Fri Apr 20, 2007 1:51 am

Here is my code.

on mouseUp
ask "Enter the Question # you would like to go to! Then press the OK button"
if it is not a number or it > 200 or it = 0
then answer "Your input must be a number and must be between 1 and 200!"
else go to card it
end mouseUp

Butttttttt when a person hits the cancel button there is displayed "Your input must be a number and must be between 1 and 200!"

What am I doing wrong and is there a better code?

Thanks!
Stu

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Fri Apr 20, 2007 8:24 am

Hi Stu,

It should be:

Code: Select all

on mouseUp
  ask "Enter the Question # you would like to go to! Then press the OK button"
  if it is empty then
    exit mouseUp
  else if it is not a number or it > 200 or it = 0 then
    answer "Your input must be a number and must be between 1 and 200!"
  else go to card it
end mouseUp
Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply