Back to Home
Visual Graph Home
TriSun Software Inc. Home
Visual Graph Site Menu
What is Visual Graph?
50 Technical Features
Abundant Graphic Libraries
Online Demo (IE Only)
Visual Graph Getting Started
Use VG Component in Delphi 6
Use VG Component in VB6
Use Graphic Library
Change Element's Shape
Make Graphic Button
Get the Selected Elements
Dynamically Create Graph
Use Line Vertexes
Call Windows API Functions
Call Visual Graph Functions
Callback Control Event in Script
Drag Graph in Run Mode
Make and Use Dialog Box
Visual Graph Getting Started - Callback Control Event in ScriptAs you know, Visual Graph allows you to declare functions in a .tbl file (via Program -> Add function... menu item), and you can call them in element's event script. Besides, it provides you with DoCommand and OnCommand matching callback mechanism.
DoCommand is a function in Visual Graph scripting language, it has two parameters, the first is current document, the second is a string that will be transfered to the document's related ActiveX control OnCommand event.
Now, we demonstrate it through a VB6 example.
1. Create a new file in Visual Graph IDE, and then draw a circle (basic element in library group) in this document.
2. Select this circle, and then double-click OnClick event in the Functions view at left to write the follow script:
DoCommand( Owner, "Hello" )
3. Save current document as h:\test.tbl.
4. Create a new project in VB6, right-click on Toolbox and select Components, and then check Visual Graph ActiveX Control and click <OK>.
5. Click vgctrl in Toolbox, and then draw an instance on Form1.
6. Write the following code in Form_Load event:
7. Write the following code in vgctrl1_OnCommand event:
8. Run this project, click the circle, you will get a message box with Hello prompt.
Legal Notices |
Contact Us |
Copyright© 2004-2013 TriSun Software Inc. All rights reserved.