Commands in ControlBar

Started by olamer · 2010-04-16 21:35 UTC · 13 replies · SMF topic #1257

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:

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

But It returns
error: invalid AutoCAD command: nil


I don't know what is happening ...

Anyone have idea ?

Thanks ...
Select the PicBox, in the properties panel change the "Event Invoke" = 1-Asynchronous
author=BazzaCAD link=topic=1257.msg6735#msg6735 date=1271455272 wrote:
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:

(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
Hi, Oswald,

add a (princ) in the end.

(defun c:TestProject_frmTest_PictureBox1_OnMouseMovedOff (/) 
      (dcl_Control_SetPicture TestProject_frmTest_PictureBox1 173)
      (princ)
)

Fred
Hi Fred,

author=Fred Tomke link=topic=1257.msg6789#msg6789 date=1271942636 wrote:
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 ...
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.
Hi Owen,

author=owenwengerd link=topic=1257.msg6791#msg6791 date=1271947268 wrote:
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:
(dcl_SendString "(line)")
Don't solve ...

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

Now it runs correctly ...

Thanks guys ..
author=Oswald link=topic=1257.msg6794#msg6794 date=1271959573 wrote:
With DCL_SendString the command executes only after next command send by user.


You needed to add a '\n' at the end.
Hi Owen,

author=owenwengerd link=topic=1257.msg6795#msg6795 date=1271962455 wrote:
You needed to add a '\n' at the end.


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

What's the best way ?
dcl_SendString or dcl_DelayedInvoke ?
author=Oswald link=topic=1257.msg6796#msg6796 date=1271967925 wrote:
What's the best way ?
dcl_SendString or dcl_DelayedInvoke ?


Yes. ;)
Hi Owen,
heheh

author=owenwengerd link=topic=1257.msg6797#msg6797 date=1271968536 wrote:
[quote author=Oswald link=topic=1257.msg6796#msg6796 date=1271967925]
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 ?
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... :)
author=Oswald link=topic=1257.msg6798#msg6798 date=1271970200 wrote:
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.
author=owenwengerd link=topic=1257.msg6800#msg6800 date=1271984744 wrote:
You can use whichever you prefer; for your purposes they are identical.

author=BazzaCAD link=topic=1257.msg6799#msg6799 date=1271980167 wrote:
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 ...