Thanks to some of you on this forum, I have been able to write some code using reactors to be able to be notified when text is changed using one of the edit commands - thereby allowing me to change the appearance of the modified text.
However, when the text is changed using the text's properties palette there is no notiifcaiton of the change. Is there a way to do this?
Here's my code so far:
Code:
;(trace evtobjectmodified)
(defun evtObjectModified (objReactor lstObjectModified / objModified)
(setq objModified (vlax-ename->vla-object (cadr lstObjectModified)))
(if (and (wcmatch (vla-get-objectname objModified) "AcDbMText,AcDbText")
(not blnRerun))
(setq lstObjectsModified (cons objModified lstObjectsModified))
)
(princ)
)
;(trace evtcommandended)
(defun evtCommandEnded (evtCall lstCallback / cmd objModified temp tstyle)
(setq cmd (car lstCallBack))
(if (and lstobjectsmodified (or (= cmd "DDEDIT")
(= cmd "MTEDIT")))
(progn
;
; Disable modification reactor before modifying data.
; Otherwise it get called for each property change.
;
(vlr-remove rxnobjectModified)
(setq blnRerun 'T)
(foreach objModified lstObjectsModified
(vla-put-color objModified 4)
(if (= 0 (getvar "pstylemode"))
(progn
(vla-put-PlotStyleName objModified "HEAVY")
) ; end progn
) ; end if
;
; For "TEXT" text, change the obliquing angle
; For "MTEXT" text, must change styles
;
(if (vlax-property-available-p objModified "ObliqueAngle")
(vla-put-ObliqueAngle objModified 0.345)
(progn
(if (setq tstyle (kbs_get_oblique_style objModified))
(vla-put-StyleName objModified tstyle)
) ; end if
) ; end progn
) ; end if
) ; end foreach
;
; Re-enable modification reactor in order to catch next user modification
;
(vlr-add rxnobjectModified)
) ; end progn
) ; end if
(setq blnRerun nil)
(setq lstObjectsModified nil)
(princ)
)
;
(setq rxnObjectModified (vlr-acdb-reactor nil '((:vlr-objectModified . evtObjectModified )))
rxnCommandEnded (vlr-editor-reactor nil '((:vlr-commandended . evtCommandEnded))))
;
Thanks in advance.
Bob