Ahmeds Posted January 11, 2013 Posted January 11, 2013 When my DCL popup/loaded, is it possible to make it focused so that the user cannot work until he entered the right code/string needed.. If the string is wrong it alerts/says like " Invalid Key" but stays loaded and focused until the user gives the right code, if the user cancels it the program quits from loading other LISPs. PS. see my attached image. Quote
pBe Posted January 11, 2013 Posted January 11, 2013 I've done something like that before, but for the love of me i can't find the code. I'll try to dig some more and maybe i stashed on some folder called "security" , rather than writing the whole thing all over again Quote
MSasu Posted January 11, 2013 Posted January 11, 2013 You may perform such validation on the event associated with OK button: (defun TestUserInput() (if (/= (get_tile "MyInputBox") MySecretKeyString) (progn (set_tile "MyInputBox" "Invalid key, please try again!") (mode_tile "MyInputBox" 2) ) (done_dialog 1) ) ) (action_tile "accept" "(TestUserInput)") (action_tile "cancel" "(done_dialog 0)") (if (= (getvar "DIASTAT") 1) [color=darkgreen] ;run the code[/color] [color=red] ;exit[/color] ) Quote
Ahmeds Posted January 11, 2013 Author Posted January 11, 2013 I've done something like that before, but for the love of me i can't find the code. I'll try to dig some more and maybe i stashed on some folder called "security" , rather than writing the whole thing all over again hope you find it soon, I'd love to wait don't worry.. MSasu, Thanks.. I'll try it later after my work. Quote
pBe Posted January 11, 2013 Posted January 11, 2013 (edited) hope you find it soon, I'd love to wait don't worry.. MSasu, Thanks.. I'll try it later after my work. I had to re-write a sample code for you [reason: I hid the file so good, i myself can't find it ] (defun C:TEST(/ dcl_id) (setq dcl_id (load_dialog "ErrorTest.dcl")) (if (not (new_dialog "ErrorTest" dcl_id)) (exit) ) (mode_tile "ValidNumber" 2) (action_tile "accept" "(validate)") (action_tile "cancel" "(done_dialog 0)") (start_dialog) (unload_dialog dcl_id) (princ) ) ----------------------- (defun validate() (if (not (eq (get_tile "ValidNumber") "[b][color="#483d8b"]12577787-12FF0023-188330[/color][/b]")) (progn (set_tile "error" "Invalid License key") (mode_tile "ValidNumber" 2)) (done_dialog) ) ) ErrorTest : dialog {label = "License Verification"; : boxed_column { : text { label = "Enter Valid License Key"; alignment = centered;} : edit_box { key = "ValidNumber";} : row { alignment = centered; : button { key = "accept"; label = "Accept"; is_default = true; } : button { key = "cancel"; label = "cancel"; } } : errtile {alignment = centered;} } } EDIT: Update DCL , anyway its the idea that counts Edited January 11, 2013 by pBe Quote
Tharwat Posted January 11, 2013 Posted January 11, 2013 (edited) Pbe, Nice DCL dialog and you added Cancel Button actione_tile without the codes related in the DCL file . One issue . You wrote the name of the DCL file upside down . (load_dialog "[color=red]errortest[/color].dcl") Edited January 11, 2013 by Tharwat Quote
pBe Posted January 11, 2013 Posted January 11, 2013 (edited) ...One issue . You wrote the name of the DCL file upside down ..... Guess I did Tharwat code updated But its cool, as long as the DCL file saved is the same name as whats written on the load_dialog expression Cheers Edited January 11, 2013 by pBe Quote
Ahmeds Posted January 14, 2013 Author Posted January 14, 2013 (edited) to All of you, Thank you guys.. Specially to pBe for the effort. Edited January 14, 2013 by Ahmeds Quote
pBe Posted January 14, 2013 Posted January 14, 2013 to All of you, Thank you guys.. Specially to pBe for the effort. Glad you find a good use for it. Holler if you need more help Cheers Ahmeds Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.