Jump to content

Recommended Posts

Posted

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.

lic.jpg

Posted

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 :lol:

Posted

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]
)

Posted
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 :lol:

 

hope you find it soon, I'd love to wait don't worry.. :D

 

MSasu, Thanks.. I'll try it later after my work.

Posted (edited)
hope you find it soon, I'd love to wait don't worry.. :D

 

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 by pBe
Posted (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 by Tharwat
Posted (edited)
...

One issue . You wrote the name of the DCL file upside down .....

 

Guess I did Tharwat :lol: 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 by pBe
Posted (edited)

to All of you, Thank you guys.. Specially to pBe for the effort.

Edited by Ahmeds
Posted
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 :)

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...