Author Topic: simple getpoint metod  (Read 1465 times)

DanielJ

  • Member
  • *
  • Posts: 5
simple getpoint metod
« on: December 05, 2012, 08:01:38 AM »
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
« Last Edit: December 05, 2012, 08:03:12 AM by DanielJ »

BazzaCAD

  • OpenDCL Webmaster
  • Administrator
  • Hero Member
  • *****
  • Posts: 850
  • Cylons will kill you
    • OpenDCL
Re: simple getpoint metod
« Reply #1 on: December 05, 2012, 08:27:15 AM »
a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

DanielJ

  • Member
  • *
  • Posts: 5
Re: simple getpoint metod
« Reply #2 on: December 05, 2012, 09:02:38 AM »
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

  • OpenDCL Webmaster
  • Administrator
  • Hero Member
  • *****
  • Posts: 850
  • Cylons will kill you
    • OpenDCL
Re: simple getpoint metod
« Reply #3 on: December 05, 2012, 11:02:17 AM »
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 2592
    • Outside The Box
Re: simple getpoint metod
« Reply #4 on: December 05, 2012, 02:33:23 PM »
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

  • Member
  • *
  • Posts: 5
Re: simple getpoint metod
« Reply #5 on: December 06, 2012, 03:46:44 AM »
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 2592
    • Outside The Box
Re: simple getpoint metod
« Reply #6 on: December 06, 2012, 11:39:59 AM »
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

  • Member
  • *
  • Posts: 5
Re: simple getpoint metod
« Reply #7 on: December 10, 2012, 03:13:58 AM »
you're right
works fine now
thanks