about graphic button's "Clicked" and "MouseMove" events...

Started by khann, July 27, 2018, 07:50:30 PM

Previous topic - Next topic

khann

Hi.
I have a graphic button with have two 
"Clicked" and "MouseMove" events at same time.

"MouseMove" event is to show its related "BlockPreview"
and
"Clicked" event is to get a point and insert the "Block"

when I clicked the button
there are number of

"Can't reenter lisp"
"Invalid point."

prompted out at the command line before I get a point .
can these messages be prevented ?

but removed the "MouseMove" event
it shows nothings. 

any reply would be appreciated.
Thannks

Fred Tomke

Hi, am I right, that the form is a modeless form/palette? Then you have to switch the button's property EventInvoke to AllowCommand.
If it is a modal form, have a look at the FAQ.
Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

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

khann

Hi, Fred.
Thank you for your reply.

The form is modeless,
and the button is EvenInvoke of 1-Asynch..
???

ODCL 8.2.0.1

Fred Tomke

Hi, can you post a small sample for debugging? Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

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

khann

Hi. Fred.
thank you for your interest.

I attach samples of a DWG and lisp files.
Type "t33" to load the test Form.

It seems that the (getpoint) function cause the "Can't reenter lisp" messages


roy_043

@khann:
You are almost there with your analysis. The problem is probably that the (getpoint) function receives input from the (c:CnMTest/Form/btnALMLT#OnMouseMove) function. Unlike BricsCAD, AutoCAD does not allow this.
See:
http://help.autodesk.com/view/OARX/2018/ENU/?guid=GUID-445F32F0-8A9D-4E1D-976F-DE87CC5267D0

One solution is to temporarily switch off OnMouseMove:
(defun c:CnMTest/Form/btnALMLT#OnClicked ( / *TP *Tmp_TBlock_Name func)
  (setq func (dcl-Control-GetProperty CnMTest/Form/btnALMLT "MouseMove"))
  (dcl-Control-SetProperty CnMTest/Form/btnALMLT "MouseMove" "") ; Switch of OnMouseMove.
  (setq *Tmp_TBlock_Name "TBlock")
  (setq *TP (getpoint "\n Block Point : ]"))
  (command "-insert" *Tmp_TBlock_Name *TP "1" "" "0")
  (dcl-Control-SetProperty CnMTest/Form/btnALMLT "MouseMove" func) ; Restore OnMouseMove.
  (princ)
)

khann

Thank you roy_043  :D :D

I was thinking something similar like this..
but I did not know about the "dcl-Control-SetProperty" function.

I can use your sample codes.
Thank you so much .  :)