simple getpoint metod

Started by DanielJ, December 05, 2012, 07:01:38 AM

Previous topic - Next topic

DanielJ

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

a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

DanielJ

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

See the second post in that link & see the "Selection" example on the advanced tab of the MasterDemo.
a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

owenwengerd

Quote from: DanielJ on December 05, 2012, 07:01:38 AM
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.
Owen Wengerd (Outside The Box) / ManuSoft

DanielJ

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

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.
Owen Wengerd (Outside The Box) / ManuSoft

DanielJ

you're right
works fine now
thanks