Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2012
    Posts
    19

    Dialog.Input Something not quite right

    I am getting a strange error with the following code.


    sCategory=Dialog.Input("NEW CATEGORY", "Please enter the Name for the New Category","" , MB_ICONQUESTION);
    SQLite.Query(db, "Insert into groups(Cat) values( "..Enclose(MyEncrypt(sCategory))..")", nil);
    ListBox.AddItem("ListBox2", sCategory);

    If the CANCEL button is clicked instead of ending the routine the code inserts a new field in the database and listbox titled CANCEL.
    What I want is for the user to be able to cancel the Dialog.Input routine and for no entries to be made in the database or ListBox.

    Any Help Appreciated
    John31

  2. #2
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,287
    Hey there John,

    I would suggest you check out the documentation on Dialog.Input.
    It specifies the behaviour of this function. When a user clicks Cancel on
    a Dialog.Input, the function returns the text CANCEL, you have to check
    for that yourself.

    Code:
    sCategory=Dialog.Input("NEW CATEGORY", "Please enter the Name for the New Category","" , MB_ICONQUESTION);
    if(sCategory ~= "CANCEL")then
    	SQLite.Query(db, "Insert into groups(Cat) values( "..Enclose(MyEncrypt(sCategory))..")", nil);
    	ListBox.AddItem("ListBox2", sCategory);
    end
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

  3. #3
    Join Date
    Feb 2012
    Posts
    19
    Many thanks for the help, I missed the bit relating to CANCEL somehow (Time to see the optician).

  4. #4
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,287
    Quote Originally Posted by John31 View Post
    Many thanks for the help, I missed the bit relating to CANCEL somehow (Time to see the optician).
    Glad to help.
    Hehe, it happens!
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts