won't happen.
ListView OnDoubleClick event wont fire a command no matter how it's defined:
(command "jbPlaceTextNote")
(dcl_sendstring "jbPlaceTextNote ")
(c:jbPlaceTextNote)
(vla-sendcommand (vla-get-activedocument(vlax-get-acad-object)) "jbPlaceTextNote ")
Event Invoke is 1 for both Form and Control. I have a TreeView on another form that fires commands just fine. I'll try to come up with a simple example to post . . ..
D*mn, never mind. My code is busted not yours Owen.
Good work btw.
OK, it is the OpenDCL code:
A simple command like (dcl_sendString ".line ") works, however something more complex like (dcl_sendString "jbPlaceNote ") bomnbs at the 3rd prompt:
(defun c:jbPlaceNote (/ *Error* text p1 p2 key note qleader qleaderObj)
(defun *Error* (Msg)
(cond ((or (not Msg)
(member Msg '("console break" "Function cancelled" "quit / exit abort"))))
((princ (strcat "\nError: " Msg))))
(princ))
(setq text (dcl_ListBox_GetText
jb002_00_KEYLIST
(dcl_ListBox_GetCurSel jb002_00_KEYLIST)))
(if (and text (/= text ""))
(progn
(setq key (substr text 1 (vl-string-position (ascii "\t") text))
note (substr text (+ 2 (vl-string-position (ascii "\t") text))))
(if (and key note)
(progn (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
(vla-StartUndoMark doc)
(jb:SetAcadDim
'((3 . "")(40 . 0.0)(60 . 0)(61 . 0)
(62 . 1)(63 . 1)(64 . 0)(65 . 0)
(67 . 2)(68 . 1)(69 . 0)(70 . 0)
(72 . 0)))
(prompt "\nSpecify first leader point: ")
(vl-cmdf "_.qleader" pause)
(prompt "\nSpecify next point: ")
(vl-cmdf pause)
;;Bombs out here - "Invalid Input"
(prompt "\nSpecify text width: ")
(vl-cmdf pause "." "")
(setq qleader (entlast))
(if (= (vla-get-objectname (setq qleaderObj (vlax-ename->vla-object qleader)))
"AcDbMText")
(progn (vlax-put-property qleaderObj 'TextString note)
(jb:putKeyNotexdata (entlast) key note "NOTELEADER")))))))
(vla-EndUndoMark doc)
(princ))
This code worked in 4.1.2.2
You you have a project file for me to test?
Fred
Wow, this is weird. I created a simplified version of this routine, the original is very complex. It works in the simple routine! WTH? There is also an interesting painting issue with the original routine - when the project is initially loaded the form isn't painted correctly, re-loading the project corrects this.
Ok, I'm attaching both. Have fun . . ..
jb002.zip is the full original Keynoting routine. Make sure that KB.key is in AutoCAD's search path. Drag the jb002.fas into AutoCAD and type "jbKeyNotes" at the command line. This is one of my "Tray" forms: it rolls up and down automatically when the mouse moves over the form. Use the little button at the top with the small arrow to pin the form up or down (when pinned down, mouse events are obviously ignored.) If you've put the KB.key file in the search path you should see the List View filled with notes. Double Click to add a Key note. If you have any questions let me know.
See here for more info http://www.theswamp.org/index.php?topic=22520.0 (http://www.theswamp.org/index.php?topic=22520.0)
Thanks Fred!
Hi, I will have a look at this late at night. My kids want to go swimming now.
Fred
Can I come? :D
Sure. :D
Fred
OK, I'm da man: first click, first bug. :D
When starting jbKeyNotes-command the form is shown. When clicking the upper left button to minimize the form I get lots of errors:
Please, don't kill me!
Edit: (maybe it depends on the light version for me...)
Fred
Hi, jb, at first: nice form handling, really nice, hard competition for palettes!
Now to you question:
Quote from: jb on June 05, 2008, 08:44:56 AM
OK, it is the OpenDCL code:
A simple command like (dcl_sendString ".line ") works, however something more complex like (dcl_sendString "jbPlaceNote ") bomnbs at the 3rd prompt:
...
This code worked in 4.1.2.2
Hm, this works for me in A17, too.
Befehl: jbPlaceNote
AcadDim updated!
Specify first leader point: _.qleader
Ersten Führungspunkt angeben oder [Einstellungen]<Einstellungen>:
Nächsten Punkt angeben:
Specify next point:
Textbreite angeben <0>:
Specify text width:
Erste Zeile des Beschriftungs-Texts eingeben <Mtext>: . Nächste Zeile des
Beschriftungs-Texts eingeben:
Befehl:
What do I have to do to reproduce your problem? Can you note some steps?
Fred
QuoteHi, jb, at first: nice form handling, really nice, hard competition for palettes!
Thanks Fred, check out the show and tell forum - I've posted a template with all the form control stuff done for you - just add your controls and go!
I think this issue
may lie in my code somewhere. I don't understand why this would be treated any different than a simple command. I think it's somewhere lurking in my code? I'm going to have another look at it this weekend.
Have fun with those kids and thanks!!!
Aaaaah, I see, the problem does not occur when I use the command jbPlaceNote directly. It only occurs when moving the mouse out off the form. The problem is that it happens because the event c:jb002_00_OnMouseMovedOff is called as a command. The current command (_qleader ) tries to interpret the command as an input. But its a wrong input (in the eyes of qleader-command).
I tried such a thing, too. I used a modeless form as a toolbar with buttons the user can pick while (getpoint) with keywords is running. In the image below you can see the function name I use. Actually there is no function name "OB": AutoCAD interprets it as an user input.
(form: EventInvoke=0, KeepFocus=yes; buttons: EventInvoke=1)
I wanted to have such a toolbar while _insert command is running, too. But I got nearly the same problem as yours: it doesn't work. In your case it works at least but there is only a little ugly message when moving the mouse out off the form. Since ObjectDCL/OpenDCL is designed to call commands, I'm afraid you will have to live with it.
I will start to debug it but I don't believe to find a solution - until I reverse my opinion or somebody corrects me.
Maybe we'll find a workaround.
Fred
I haven't looked closely at the code, but would it help to precede the command with ^C^C?
Hello Owen,
if I understood jb right - please correct me - then his problem is this:
(vl-cmdf "_.qleader" pause)
(prompt "\nSpecify next point: ")
(vl-cmdf pause)
;;Bombs out here - "Invalid Input"
(prompt "\nSpecify text width: ")
(vl-cmdf pause "." "")
That means: when moving the mouse off the form then an event is called as a command and thats why the leader command (which allows additional options at this point) returns invalid input message. I don't belive it is a problem calling the listview dblclick event. I hope I described it understandable.
Fred
I see. It sounds like the form should be disabled while a command is active.
That sounds interesting. I remember a method I translated :) . It may also work at a palette of mine. Until now I call a (foreach oCtrl (dcl_form_getcontrols oForm) (dcl_control_setenabled oCtrl nil) .
I will have a try at jb's form.
Fred
Guys, I posted an example, a simple modeless form, where this scenario works: the 012.zip I attached earlier in the thread has a modeless form with ONLY a listview control - no other controls - and the doubleclick/qleader command functions as expected.
So I think there might be another issue with the jb002.zip form: the listview is on a tab control, which in the editor comes up as another form? Is the container for tabs another form? Will it fire it's own mouse events which aren't managed or trappable at this time??
It seems to me that some other control on jb002.zip's form is causing the problem because the simple 012.zip form works as expected. I'm also suspect about this particular form because it's the only one out of seven other complex forms that has a re-painting issue.
Thanks for the help guys - other than this - alpha 17 is working pretty well.
Hi Owen, I'd like to disable the form - but it seems that there is a type mismatch (or something else). The form doesn't seem to support an enable-method.
Fred
That is a bug. I've fixed this for Alpha 19.
Hey, Hijackers - what about my problem?? ;)
Quote from: jb on June 09, 2008, 11:17:55 AM
Hey, Hijackers - what about my problem?? ;)
In the meantime, try doing what Fred suggested in http://www.opendcl.com/forum/index.php?topic=356.msg1566#msg1566 to see if that addresses the problem.
Hello Owen,
is (dcl_form_enable oForm nil)
internally the same as (foreach oCtrl (dcl_form_getcontrols oForm) (dcl_control_setenabled oCtrl nil)
? My hope was that (dcl_form_enable oForm nil)
would also suppress calling the OnMouseMovedOff event. Because that is in my opinion the original reason.
I added an animated GIF. @jb: is it the problem I'm showing?
What you see is a modified lisp with disabling the form meanwhile (using the way I suggested). But you cannot get any notice of it because you work with sendcommand. I will have a last try with (c:jbPlaceTextNote), (c:jbPlaceNote) and (c:jbPlaceKeyNote) instead.
... I had a try. With really interesting results: Completely unusable. :-\ (see second screenshot)
Fred
Fred, disabling all the controls is not the same as disabling the form, because as you found, an enabled form still processes mouse messages.