Using commands / vl-cmdf "#onclose"

Started by Lube, December 29, 2015, 04:01:04 AM

Previous topic - Next topic

Lube

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

Fred Tomke

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
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Lube

Hello Fred! It's a palette.. Can you be a little bit more precise?
Thanks, Dennis

Lube

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

roy_043

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.