How to run/call commands in Modal Form

Started by Eddiefromdc, January 16, 2025, 07:17:50 PM

Previous topic - Next topic

Eddiefromdc

I'm trying to achieve a simple "layer walk" like routine but with a list of selected/desired layers.
It works good for me on Modeless form with a grid control, SelChanged event. Here is a partial code.

(defun c:ChkDwg_ChkDwg_Grid1#OnSelChanged (Row Column / sSelText)
(setq LayName (Dcl_Grid_GetCurSel ChkDwg_ChkDwg_Grid1))
(setq rowinfo (Dcl_Grid_GetRowItems ChkDwg_ChkDwg_Grid1 (car LayName)))
(setq sSelText (nth 0 rowinfo))
(command "layer" "off" "*" "" "")
(command "layer" "on" sSeltext "")
(command "layer" "s" sSelText "")
(command "layer" "off" "*" "" "")
)

But I'm afraid with a Modeless form I might forget to close it before I open another drawing
or if I switch to an open drawing.

So, I think a Modal form works better for me. But I can't make it work. Please look at this code.

(defun c:ChkDwg_ChkDwg_Grid1#OnSelChanged (Row Column / sSelText)
(setq LayName (Dcl_Grid_GetCurSel ChkDwg_ChkDwg_Grid1))
(setq rowinfo (Dcl_Grid_GetRowItems ChkDwg_ChkDwg_Grid1 (car LayName)))
(setq sSelText (nth 0 rowinfo))
(dcl-SendString "-layer off *  ")
(dcl-SendString "-layer on sSeltext *  ")
(dcl-SendString "-layer s sSeltext *  ")
(dcl-SendString "-layer off *  ")
)

Any help would be appreciated.