Commands in ControlBar

Started by Oswald, April 16, 2010, 02:35:23 PM

Previous topic - Next topic

Oswald

Hi People ....

I make a ControlBar in a ODCL Test Project.

I put in ControlBar an PictureBox with Clicked Event.
In my c:TestProject_ControlBar1_PictureBox1_OnClicked I put this code:
Code (autolisp) Select

(c:TestProject_ControlBar1_PictureBox1_OnClicked (/)
   (command "line")
)

But It returns
Quoteerror: invalid AutoCAD command: nil

I don't know what is happening ...

Anyone have idea ?

Thanks ...

BazzaCAD

Select the PicBox, in the properties panel change the "Event Invoke" = 1-Asynchronous
a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

Oswald

Quote from: BazzaCAD on April 16, 2010, 03:01:12 PM
Event Invoke" = 1-Asynchronous

Thanks Bazza.
It really works.
But I have in the same PicBox an OnMouseEntered and OnMouseMovedOff event.
And each mouse move on the PicBox put the function return in command line.

Have any command to avoid this command return ?

Bellow the code:
Code (autolisp) Select

(defun c:TestProject_frmTest_PictureBox1_OnMouseEntered (/)
(dcl_Control_SetPicture TestProject_frmTest_PictureBox1 174)
(princ "ttt")
)
(defun c:TestProject_frmTest_PictureBox1_OnMouseMovedOff (/)
  (dcl_Control_SetPicture TestProject_frmTest_PictureBox1 173)
)


Put T in command line

Thanks for all

Fred Tomke

Hi, Oswald,

add a (princ) in the end.

Code (autolisp) Select
(defun c:TestProject_frmTest_PictureBox1_OnMouseMovedOff (/) 
      (dcl_Control_SetPicture TestProject_frmTest_PictureBox1 173)
      (princ)
)


Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

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

Oswald

Hi Fred,

Quote from: Fred Tomke on April 22, 2010, 06:23:56 AM
add a (princ) in the end.

I add (princ) but on each MouseOver/Out it makes new line print
Example:
Command:
Command:
Command:
Command:


Thanks ...

owenwengerd

You can set Event Invoke back to Synchronous, but execute your (command) calls from within a different function that you initiate by calling (dcl_SendString) or (dcl_DelyedInvoke).

By the way, if all goes according to plan, the next build of OpenDCL will not need the OnMouseEntered and OnMouseMovedOff handlers to switch the Keep Focus setting.
Owen Wengerd (Outside The Box) / ManuSoft

Oswald

Hi Owen,

Quote from: owenwengerd on April 22, 2010, 07:41:08 AM
You can set Event Invoke back to Synchronous, but execute your (command) calls from within a different function that you initiate by calling (dcl_SendString) or (dcl_DelyedInvoke).

Following your instructions I test using dcl_SendString and dcl_DelayedInvoke.

With DCL_SendString the command executes only after next command send by user.
The command was:
Code (autolisp) Select
(dcl_SendString "(line)")
Don't solve ...

Then I test DCL_DelayedInvoke ...
Code (autolisp) Select
(dcl_DelayedInvoke 100 "(line)")
Then I solve my problem. ...

Now it runs correctly ...

Thanks guys ..

owenwengerd

Quote from: Oswald on April 22, 2010, 11:06:13 AM
With DCL_SendString the command executes only after next command send by user.

You needed to add a '\n' at the end.
Owen Wengerd (Outside The Box) / ManuSoft

Oswald

Hi Owen,

Quote from: owenwengerd on April 22, 2010, 11:54:15 AM
You needed to add a '\n' at the end.

Really ... It works ...
I use thist:
Code (autolisp) Select
(dcl_SendString "(line)\n")
Then run ...

What's the best way ?
dcl_SendString or dcl_DelayedInvoke ?

owenwengerd

Quote from: Oswald on April 22, 2010, 01:25:25 PM
What's the best way ?
dcl_SendString or dcl_DelayedInvoke ?

Yes. ;)
Owen Wengerd (Outside The Box) / ManuSoft

Oswald

Hi Owen,
heheh

Quote from: owenwengerd on April 22, 2010, 01:35:36 PM
Quote from: Oswald on April 22, 2010, 01:25:25 PM
What's the best way ?
dcl_SendString or dcl_DelayedInvoke ?
Yes. ;)

Thanks for your answer
But what is the best method to use ?
SendString or DelayedInvoke ...
Or they're the same ?

BazzaCAD

I think he's suggesting that either one works just as good.
I'd use (dcl_SendString) so I don't have to deal with the delay, but that's just me... :)
a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

owenwengerd

Quote from: Oswald on April 22, 2010, 02:03:20 PM
But what is the best method to use ?
SendString or DelayedInvoke ...
Or they're the same ?

You can use whichever you prefer; for your purposes they are identical.
Owen Wengerd (Outside The Box) / ManuSoft

Oswald

Quote from: owenwengerd on April 22, 2010, 06:05:44 PM
You can use whichever you prefer; for your purposes they are identical.
Quote from: BazzaCAD on April 22, 2010, 04:49:27 PM
I think he's suggesting that either one works just as good.
I'd use (dcl_SendString) so I don't have to deal with the delay, but that's just me... :)

Owen and Bazza ...

Thanks again ...