[Manifold-l] Open form from drawing
adamw at manifold.net
adamw at manifold.net
Mon Mar 5 08:39:54 CST 2007
> I have looked the onclick example in the help my VB expereince has come
> from within Access and I am not having much luck finding the scripting
> reference to open a form based on an objects ID in a drawing.
Save the object ID into a comments section, then run the form, read the saved object ID back and initialize the form accordingly.
Example OnClick script:
Sub Main
If EventArgs.HasObject Then
If EventArgs.Object.OwnerComponent.Name = "Drawing" Then
name = "_ClickedObjectID"
Set cset = Document.ComponentSet
If cset.ItemByName(name) < 0 Then
Set cmt = Document.NewComments(name)
Else
Set cmt = cset(name)
End If
cmt.Text = EventArgs.Object.ID
cset("Form").Run
EventArgs.Handled = true
End If
End If
End Sub
Example form script:
Set obj = Nothing
Sub Main
Set cset = Document.ComponentSet
Set cmt = cset("_ClickedObjectID")
Set drw = cset("Drawing")
Set obj = drw.ObjectSet(drw.ObjectSet.ItemByID(CInt(cmt.Text)))
Form.Visible = True
End Sub
Sub Form_OnLoad
WLText1.Text = obj.Record.Data("Coordinates (I)")
End Sub
--
Adam Wachowski
Manifold Development Team
More information about the Manifold-l
mailing list