OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: Lube on December 29, 2015, 04:01:04 AM

Title: Using commands / vl-cmdf "#onclose"
Post by: Lube on December 29, 2015, 04:01:04 AM
Hello guys, I've got a problem..

I need to undefine a command defined in "#oninitialize" but it doesn't work..
Maybe it's something like synchronous/asynchronous but why it works on #oninitialize?

Code (autolisp) Select
(defun C:cancella (/ i deleted )
  (setq deleted (ssget)
        i 0)
  (repeat (sslength deleted)
  (entdel (ssname deleted i))
    (setq i (1+ i))
  )
 
  (conta_elementi nome)
;(princ)
)


and

Code (autolisp) Select
(defun c:Cobiax/Main#OnClose (UpperLeftX UpperLeftY /)
  (setvar "CMDECHO" 0)
  (vl-cmdf "_redefine" "cancella")
  (setvar "CMDECHO" 1)
)


Thanks, Dennis
Title: Re: Using commands / vl-cmdf "#onclose"
Post by: Fred Tomke on December 29, 2015, 11:14:25 AM
Hi, Lube, modeless or modal form? Just some thoughts without having some tests yet:
In modeless forms there is a event invoke property as well as it is for the controls on modeless forms. Maybe switch it to allow command.
Or you call the command using dcl_delayedinvoke to call it asynchronously.

Regards, Fred
Title: Re: Using commands / vl-cmdf "#onclose"
Post by: Lube on January 04, 2016, 09:55:14 AM
Hello Fred! It's a palette.. Can you be a little bit more precise?
Thanks, Dennis
Title: Re: Using commands / vl-cmdf "#onclose"
Post by: Lube on January 05, 2016, 01:23:16 AM
Guys I really need help in this.. I'm getting mad  :'(

Code (autolisp) Select
(defun C:cancella (/ i deleted )
  (IF (dcl-Form-IsActive Cobiax/Main)
    (progn
     
    (princ "\n Selezionare gli alleggerimenti da eliminare")
    (setq deleted (ssget)
        i 0)
  (repeat (sslength deleted)
  (entdel (ssname deleted i))
    (setq i (1+ i))
  )
 
  (conta_elementi nome)
    )
    (progn
    (redef "cancella")
    (redef "erase")
    (command "._erase")
    )
    )
 
;(princ)
)


I've tryed this way but it lose the shortcut in the first cicle :/
Title: Re: Using commands / vl-cmdf "#onclose"
Post by: roy_043 on January 05, 2016, 02:47:33 AM
Quote from: Lube on January 04, 2016, 09:55:14 AM
Hello Fred! It's a palette.. Can you be a little bit more precise?
Thanks, Dennis
I think it is you who should try to be more precise. It will help if you explain better and perhaps post some files.