home *** CD-ROM | disk | FTP | other *** search
/ PC Shareware 2000 January / PCShareware-1-00.iso / trials / Fc7 / ABC.Z / MOVE.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-12-16  |  6.0 KB  |  177 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Appearance      =   0  'Flat
  4.    BackColor       =   &H80000005&
  5.    Caption         =   "Move Event DEMO"
  6.    ClientHeight    =   3405
  7.    ClientLeft      =   1320
  8.    ClientTop       =   1695
  9.    ClientWidth     =   3840
  10.    BeginProperty Font 
  11.       name            =   "MS Sans Serif"
  12.       charset         =   0
  13.       weight          =   700
  14.       size            =   8.25
  15.       underline       =   0   'False
  16.       italic          =   0   'False
  17.       strikethrough   =   0   'False
  18.    EndProperty
  19.    ForeColor       =   &H80000008&
  20.    Height          =   3810
  21.    Icon            =   "MOVE.frx":0000
  22.    Left            =   1260
  23.    LinkTopic       =   "Form1"
  24.    ScaleHeight     =   3405
  25.    ScaleWidth      =   3840
  26.    Top             =   1350
  27.    Width           =   3960
  28.    Begin VB.PictureBox Picture1 
  29.       Appearance      =   0  'Flat
  30.       BackColor       =   &H80000005&
  31.       BorderStyle     =   0  'None
  32.       ForeColor       =   &H80000008&
  33.       Height          =   495
  34.       Left            =   255
  35.       Picture         =   "MOVE.frx":030A
  36.       ScaleHeight     =   495
  37.       ScaleWidth      =   495
  38.       TabIndex        =   4
  39.       Top             =   2070
  40.       Width           =   495
  41.    End
  42.    Begin AbcflowLib.ABC ABC1 
  43.       Height          =   495
  44.       Left            =   120
  45.       TabIndex        =   5
  46.       Top             =   2760
  47.       Width           =   495
  48.       _version        =   65536
  49.       _extentx        =   873
  50.       _extenty        =   873
  51.       _stockprops     =   1
  52.    End
  53.    Begin VB.Label Label3 
  54.       Appearance      =   0  'Flat
  55.       BackColor       =   &H80000005&
  56.       Caption         =   "(c) Micrografx Inc., 1996. All Rights Reserved."
  57.       ForeColor       =   &H80000008&
  58.       Height          =   390
  59.       Left            =   885
  60.       TabIndex        =   0
  61.       Top             =   2145
  62.       Width           =   3000
  63.    End
  64.    Begin VB.Label Label4 
  65.       Appearance      =   0  'Flat
  66.       BackColor       =   &H80000005&
  67.       Caption         =   "Additionally, X && Y field values are updated indicating each selected shape's position on the chart."
  68.       ForeColor       =   &H80000008&
  69.       Height          =   735
  70.       Left            =   240
  71.       TabIndex        =   3
  72.       Top             =   1200
  73.       Width           =   3495
  74.    End
  75.    Begin VB.Label Label1 
  76.       Appearance      =   0  'Flat
  77.       BackColor       =   &H80000005&
  78.       Caption         =   $"MOVE.frx":0614
  79.       ForeColor       =   &H80000008&
  80.       Height          =   1095
  81.       Left            =   240
  82.       TabIndex        =   2
  83.       Top             =   120
  84.       Width           =   3375
  85.    End
  86.    Begin VB.Label Label2 
  87.       Appearance      =   0  'Flat
  88.       BackColor       =   &H80000005&
  89.       Caption         =   "<---- Double-click on this custom OCX in VB 4.0 edit mode to see the event handling code."
  90.       ForeColor       =   &H80000008&
  91.       Height          =   585
  92.       Left            =   720
  93.       TabIndex        =   1
  94.       Top             =   2730
  95.       Visible         =   0   'False
  96.       Width           =   3015
  97.    End
  98. Attribute VB_Name = "Form1"
  99. Attribute VB_Creatable = False
  100. Attribute VB_Exposed = False
  101. Private Sub ABC1_AppQuitNOTIFY()
  102.     End
  103. End Sub
  104. Private Sub ABC1_ChartNewNOTIFY(ByVal Chart As Object)
  105.     Call AddFields(Chart)
  106. End Sub
  107. Private Sub ABC1_FieldValueChangedNOTIFY(ByVal FieldValue As Object, ByVal Object As Object, ByVal Chart As Object)
  108.     If FieldValue.Name = "X" Then
  109.         Object.CenterX = FieldValue.Value
  110.     End If
  111.     If FieldValue.Name = "Y" Then
  112.         Object.CenterY = FieldValue.Value
  113.     End If
  114.     If FieldValue.Name = "Color" Then
  115.         NewColor = FieldValue.Value
  116.         ' Use WHITE if an invalid color is entered
  117.         If NewColor > 256 Or NewColor < 0 Then NewColor = 0
  118.         Object.Shape.FillColor = ABC1.App.BasicColor(NewColor)
  119.     End If
  120.     If FieldValue.Name = "Text" Then
  121.         Object.Text = FieldValue.Value
  122.     End If
  123. End Sub
  124. Private Sub ABC1_NewShapeNOTIFY(ByVal Object As Object, ByVal Chart As Object)
  125.     Call ABC1_ObjectMovedNOTIFY(Object, Chart)
  126. End Sub
  127. Private Sub ABC1_ObjectMovedNOTIFY(ByVal Object As Object, ByVal Chart As Object)
  128.     Dim Obj As Object, Objs As Object
  129.     If Chart.SelectedObjectCount = 1 Then
  130.         Color = ABC1.App.YELLOW
  131.     Else
  132.         Color = ABC1.App.GREEN
  133.     End If
  134.     ABC1.App.HourGlass = True
  135.     Set Objs = Chart.Objects
  136.     Do
  137.         Set Obj = Objs.ItemFromSelection
  138.         Obj.Color = Color
  139.         Obj.FieldValues.Item("X").Value = Obj.CenterX
  140.         Obj.FieldValues.Item("Y").Value = Obj.CenterY
  141.     Loop While Obj.Valid
  142.     ABC1.App.HourGlass = False
  143. End Sub
  144. Private Sub AddFields(Chart As Object)
  145.     Dim NewField As Object
  146.     Chart.NoRepaint = True
  147.     Set NewField = Chart.FieldTemplates.Add("X")
  148.     NewField.Format = 501
  149.     Set NewField = Chart.FieldTemplates.Add("Y")
  150.     NewField.Format = 501
  151.     Set NewField = Chart.FieldTemplates.Add("Color")
  152.     NewField.Format = 500
  153.     NewField.Hidden = True
  154.     Chart.NoRepaint = False
  155.     Chart.Repaint
  156. End Sub
  157. Private Sub Form_Load()
  158.     Dim ABCApp As Object
  159.     Dim CurrentChart As Object
  160.     Set ABCApp = CreateObject("ABCFlow.application")
  161.     ABCApp.Visible = True
  162.     ABCApp.RegisterEvent ABC1, Form1.Caption, "ChartNewNOTIFY"
  163.     ABCApp.RegisterEvent ABC1, Form1.Caption, "FieldValueChangedNOTIFY"
  164.     ABCApp.RegisterEvent ABC1, Form1.Caption, "ObjectMovedNOTIFY"
  165.     ABCApp.RegisterEvent ABC1, Form1.Caption, "NewShapeNOTIFY"
  166.     ' Get the ABC Quit event so the Menu
  167.     ' sample can unload when ABC Quits
  168.     ABCApp.RegisterEvent ABC1, Form1.Caption, "AppQuitNOTIFY"
  169.     Set CurrentChart = ABCApp.ActiveChart
  170.     If (Not CurrentChart.Valid) Then
  171.         MsgBox "Cannot run without a chart. Open a chart in ABC and run the " + App.Title + " again."
  172.         End
  173.     Else
  174.         Call AddFields(CurrentChart)
  175.     End If
  176. End Sub
  177.