Text Change Event

J

John

Hi there,

I have a shape that with an inserted field that reflects the string in a
custom property ("Prop.Name"). The shape's LockTextEdit cell is set to true
so that the inserted field can't be overwritten, but I'd like to create an
event that would catch the user trying to type directly to the selected
shape and then enter the text in the Prop.Name custom properties field.

So can anyone suggest what event I should try and capture? At the moment if
the user type directly on a selected shape they get the "Shape
protection..." warning popping up, but I assume I can't use a cell change
event as nothing has actually changed at that point?

(NB I'd prefer for the text to appear in the Custom Properties Window if
it's open and only if it's not, then to open the custom properties dialogue
box (DoCmd1312).

Anyway, thanks in advance

Best regards

John
 
J

JuneTheSecond

CellChanged events or FormulaChanged events might be one idea.
For example,

Private shp As Visio.Shape
Private WithEvents myCell As Visio.Cell

Private Sub Document_DocumentSaved(ByVal doc As IVDocument)
Set shp = ActivePage.Shapes("Sheet.3")
Set myCell = shp.Cells("Prop.Row_1")
End Sub

Private Sub myCell_CellChanged(ByVal Cell As IVCell)
If myCell.Name = "Prop.Row_1" Then
MsgBox "myCell_CellChanged " & Cell.Formula
End If
End Sub
 
J

John

Hello June,

Thanks for this. The trouble is that if the user starts typing with a shape
selected, the Prop.Row_1 doesn't get changed, neither does 'TheText' as the
shape's LockTextEdit property is set to true. The only thing that appears
is the warning message.

Any other thoughts?

Best regards

John
 
J

JuneTheSecond

Might be noway for the dialog of builtin custom property. other than that you
build your own userform for input. And you might disable for the user to use
custom propety dialog in any difficult way.
 
A

andrew.wagg

Might be noway for the dialog of builtin custom property. other than that you
build your own userform for input. And you might disable for the user to use
custom propety dialog in any difficult way.

You could catch the keyPress event on the visio application, this is
triggered before the shape protection message appears. You can then
set cancelDefault to true. Then open your own dialog and insert the
character that was typed.
 
J

John

Thanks Andrew (and to June for the second post). I'll take your advice, but
I guess I was hoping that there would be an event that's already triggered
by trying to edit the text when LockText Edit is set to true. I assume that
the Visio engine has this internally even if it doesn't expose the
functionality externally.

Anyway, thanks again to all for your help.

Best regards

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top