Author Topic: Multiline Tooltips  (Read 4215 times)

0 Members and 1 Guest are viewing this topic.

mr_nick

  • Guest
Multiline Tooltips
« on: July 31, 2006, 10:16:24 AM »
Is it possible, using VBA, to emulate the multiline tooltips which were offered by ODCL?

FengK

  • Guest
Re: Multiline Tooltips
« Reply #1 on: September 12, 2006, 03:22:53 AM »
If you don't mind using a 3rd party tool (which is free), I'd recommend AutoIt which comes an ActiveX/COM version of it called AutoItX.  (It is a DLL version of AutoIt v3 that provides a subset of the features of AutoIt via an ActiveX/COM and DLL interface.) Once you register the .dll, to use the functions provided by it is fairly straight forward.  Here is an example of using tooltip in lisp.  Using it in VBA should be easier.

;;;SYNTAX: (KF:AI_Tooltip msg milSec pt)
;;;CATEGORY: AutoIt
;;;FUNCTION: Display a tooltip message
;;;ARGUMENT: msg - message to display [STR]
;;;          milSec - length of time in millisecond [INT]
;;;          pt - a list of two item specifing x & y coordinates of tooltip [LST]
;;;              use nil to omit.
;;;RETURN: None
;;;NOTE:
;;;SEE ALSO:
;;;SAMPLE USAGE:
;;;(KF:AI_Tooltip "OTHRO mode is on." 2000 nil)
;;;(KF:AI_Tooltip "OTHRO mode is on." nil nil)
(defun KF:AI_Tooltip (msg milSec pt / oAutoIt)
  (setq   oAutoIt   (vla-getinterfaceobject
        (vlax-get-acad-object)
        "AutoItX3.Control"
      )
  )
  (if pt
    (vlax-invoke
      oAutoIt
      'ToolTip
      msg
      (car pt)
      (cadr pt)
    )
    (vlax-invoke
      oAutoIt
      'ToolTip
      msg
    )
  )
  (if milSec
    (vlax-invoke
      oAutoIt
      'Sleep
      milSec
    )
    (while (not (getstring "\nPress any key to close tooltip..."))
      (command "DELAY" 500)
    )
  )
  (vlax-invoke
    oAutoIt
    'ToolTip
    ""
  )
)