5.0.0.17 - ListView - onDblClick - sending a command

Started by jb, June 05, 2008, 07:51:28 AM

Previous topic - Next topic

jb

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 . . ..
   
James Buzbee
Managing Memeber
Black Horse Development, LLC

jb

D*mn, never mind.  My code is busted not yours Owen.






Good work btw.
James Buzbee
Managing Memeber
Black Horse Development, LLC

jb

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
James Buzbee
Managing Memeber
Black Horse Development, LLC

Fred Tomke

Fred Tomke
Dipl.-Ing. (FH) Landespflege

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

jb

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

Thanks Fred!
James Buzbee
Managing Memeber
Black Horse Development, LLC

Fred Tomke

Hi, I will have a look at this late at night. My kids want to go swimming now.

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

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

jb

James Buzbee
Managing Memeber
Black Horse Development, LLC

Fred Tomke

Fred Tomke
Dipl.-Ing. (FH) Landespflege

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

Fred Tomke

#8
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
Fred Tomke
Dipl.-Ing. (FH) Landespflege

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

Fred Tomke

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
Fred Tomke
Dipl.-Ing. (FH) Landespflege

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

jb

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!!!
James Buzbee
Managing Memeber
Black Horse Development, LLC

Fred Tomke

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
Fred Tomke
Dipl.-Ing. (FH) Landespflege

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

owenwengerd

I haven't looked closely at the code, but would it help to precede the command with ^C^C?
Owen Wengerd (Outside The Box) / ManuSoft

Fred Tomke

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
Fred Tomke
Dipl.-Ing. (FH) Landespflege

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

owenwengerd

I see.  It sounds like the form should be disabled while a command is active.
Owen Wengerd (Outside The Box) / ManuSoft