Started by DanielJ ·
2012-12-05 15:01 UTC ·
7 replies · SMF topic #1927
DanielJ
2012-12-05 15:01 UTC
Hi, can anyone tell why simple command doesnt work, i mean i cannot normally close form and show it back
routine is simple - on button click
this code closes form, gets point but doesnt show form1 again
(defun c:Programy_Form1_TextButton3_OnClicked (/)
(dcl_Form_Close Programy_Form1)
(setq pkt (getpoint))
(dcl_Form_Show Programy_Form1)
)
I'm beginner, so dont yell at me
bazzacad
2012-12-05 15:27 UTC
No yelling here:
http://www.opendcl.com/forum/index.php?topic=1080.0
DanielJ
2012-12-05 16:02 UTC
yes i saw it, but i don't really get it
code in link is in main lisp routine and i want to pick point on event "click button"
bazzacad
2012-12-05 18:02 UTC
See the second post in that link & see the "Selection" example on the advanced tab of the MasterDemo.
owenwengerd
2012-12-05 21:33 UTC
author=DanielJ link=topic=1927.msg9440#msg9440 date=1354719698 wrote:
this code closes form, gets point but doesnt show form1 again
The call to (dcl_Form_Close) closes the form itself, but the form's code is still running until the callback function returns. Instead of calling (dcl_Form_Show) for the second dialog from within the callback, you have to call it
after the initial (dcl_Form_Show) returns. The samples demonstrate how to do that by returning a dialog result via (dcl_Form_Close) that you can then use in your main function to determine that the second dialog should be shown after the first is closed.
DanielJ
2012-12-06 10:46 UTC
ok guys,
I apologize, i was so hurry yesterday that i didnt notice that opendcl has samples in main folder
i still have one small problem in code
(command "OPENDCL")
(dcl_Project_Load "Programy" T)
(dcl_Form_Show Programy_Form1)
(defun drukuj () (setq pkt (getpoint))
(setq doContinue T)
)
(defun c:Programy_Form1_TextButton3_OnClicked (/)
(dcl_form_close Programy_Form1 3)
)
(setq doContinue T)
(while doContinue
(setq doContinue nil)
(setq intResult (dcl_form_show Programy_Form1))
(cond
((= intResult 1) (setq doContinue nil))
((= intResult 2) (setq doContinue nil))
((= intResult 3) (drukuj))
); cond
)
code works as I want but after second click on TextButton3, i mean after load lsp and clicking textbutton3 it closes form and opens it again, till next click works fine (after click first ask to pick point and after that opens form again)
what is wrong with that code?
owenwengerd
2012-12-06 18:39 UTC
You are showing the form before the needed functions are defined. Move the call to (dcl_Form_Show) to a point after the functions are defined, then it should work.
DanielJ
2012-12-10 10:13 UTC
you're right
works fine now
thanks