home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 November / pcwk_11_98a.iso / Wtestowe / Vistdtk / Install / Data.Z / Orgchart.FRM < prev    next >
Text File  |  1996-09-05  |  11KB  |  342 lines

  1. VERSION 4.00
  2. Begin VB.Form frmOrgChart 
  3.    Appearance      =   0  'Flat
  4.    BackColor       =   &H00C0C0C0&
  5.    Caption         =   "Visio Organizational Chart"
  6.    ClientHeight    =   5430
  7.    ClientLeft      =   705
  8.    ClientTop       =   2040
  9.    ClientWidth     =   6270
  10.    FillColor       =   &H00808080&
  11.    FillStyle       =   0  'Solid
  12.    BeginProperty Font 
  13.       name            =   "MS Sans Serif"
  14.       charset         =   0
  15.       weight          =   700
  16.       size            =   8.25
  17.       underline       =   0   'False
  18.       italic          =   0   'False
  19.       strikethrough   =   0   'False
  20.    EndProperty
  21.    ForeColor       =   &H00808080&
  22.    Height          =   6120
  23.    Icon            =   "ORGCHART.frx":0000
  24.    KeyPreview      =   -1  'True
  25.    Left            =   645
  26.    LinkTopic       =   "Form1"
  27.    ScaleHeight     =   5430
  28.    ScaleWidth      =   6270
  29.    Top             =   1410
  30.    Width           =   6390
  31.    Begin VB.Frame Frame1 
  32.       Appearance      =   0  'Flat
  33.       BackColor       =   &H00C0C0C0&
  34.       Caption         =   "Organization Chart"
  35.       ForeColor       =   &H00000000&
  36.       Height          =   4455
  37.       Left            =   120
  38.       TabIndex        =   3
  39.       Top             =   840
  40.       Width           =   6015
  41.       Begin MSOutl.Outline Outline1 
  42.          Height          =   3975
  43.          Left            =   120
  44.          TabIndex        =   2
  45.          TabStop         =   0   'False
  46.          Top             =   360
  47.          Width           =   5775
  48.          _Version        =   65536
  49.          _ExtentX        =   10186
  50.          _ExtentY        =   7011
  51.          _StockProps     =   77
  52.          ForeColor       =   -2147483640
  53.          BackColor       =   -2147483643
  54.          Style           =   4
  55.          PicturePlus     =   "ORGCHART.frx":030A
  56.          PictureMinus    =   "ORGCHART.frx":0404
  57.          PictureLeaf     =   "ORGCHART.frx":04FE
  58.          PictureOpen     =   "ORGCHART.frx":05F8
  59.          PictureClosed   =   "ORGCHART.frx":06F2
  60.       End
  61.    End
  62.    Begin VB.TextBox Text1 
  63.       Appearance      =   0  'Flat
  64.       BackColor       =   &H00FFFFFF&
  65.       BeginProperty Font 
  66.          name            =   "MS Sans Serif"
  67.          charset         =   0
  68.          weight          =   700
  69.          size            =   9.75
  70.          underline       =   0   'False
  71.          italic          =   0   'False
  72.          strikethrough   =   0   'False
  73.       EndProperty
  74.       Height          =   360
  75.       Left            =   120
  76.       TabIndex        =   0
  77.       TabStop         =   0   'False
  78.       Text            =   "Text1"
  79.       Top             =   360
  80.       Width           =   6015
  81.    End
  82.    Begin VB.Label Label1 
  83.       Appearance      =   0  'Flat
  84.       BackColor       =   &H00C0C0C0&
  85.       Caption         =   "Name:"
  86.       ForeColor       =   &H80000008&
  87.       Height          =   255
  88.       Left            =   120
  89.       TabIndex        =   1
  90.       Top             =   120
  91.       Width           =   6015
  92.    End
  93.    Begin VB.Menu mnuChart 
  94.       Caption         =   "&Chart"
  95.       Begin VB.Menu mnuChartItem 
  96.          Caption         =   "Show &All Items"
  97.          Checked         =   -1  'True
  98.          Index           =   0
  99.          Shortcut        =   ^A
  100.       End
  101.       Begin VB.Menu mnuChartItem 
  102.          Caption         =   "&Create Chart"
  103.          Index           =   1
  104.       End
  105.       Begin VB.Menu mnuChartItem 
  106.          Caption         =   "Read Chart From &Visio"
  107.          Index           =   2
  108.       End
  109.    End
  110.    Begin VB.Menu mnuCommand 
  111.       Caption         =   "C&ommands"
  112.       Begin VB.Menu mnuCommandItem 
  113.          Caption         =   "&Promote"
  114.          Index           =   0
  115.       End
  116.       Begin VB.Menu mnuCommandItem 
  117.          Caption         =   "&Demote"
  118.          Index           =   1
  119.       End
  120.       Begin VB.Menu mnuCommandItem 
  121.          Caption         =   "De&lete"
  122.          Index           =   2
  123.       End
  124.       Begin VB.Menu mnuCommandItem 
  125.          Caption         =   "Delete B&ranch"
  126.          Index           =   3
  127.       End
  128.    End
  129. End
  130. Attribute VB_Name = "frmOrgChart"
  131. Attribute VB_Creatable = False
  132. Attribute VB_Exposed = False
  133. '------------------------------------------------------------------------------
  134. '------------------------------------------------------------------------------
  135. '--
  136. '--                       Visio Organization Chart AddOn
  137. '--                       (C)1993 Shapeware Corporation
  138. '--
  139. '--   File Name : OrgChart.frm
  140. '--
  141. '-- Description : Main form for the OrgChart AddOn
  142. '--
  143. '--
  144. '--
  145. '--
  146. '-- Audit Trail:
  147. '--
  148. '-- 09/15/93 - v3.000 - aw -    Moved code into the module orchart.bas.
  149. '--                             Started on keyboard equiv, but needs more work!
  150. '--                             Idea was to make a global keyboard handler which
  151. '--                             explains why form.Keypreview = False etc.
  152. '--                             Reorganized the menus according to the code that
  153. '--                             I moved to the module.
  154. '-- 07/**/93 - v2.000 - bl -    Added option read orgchart in menu chart.
  155. '-- **/**/** - v1.000 - ** -    Created.
  156. '--
  157. '------------------------------------------------------------------------------
  158. '------------------------------------------------------------------------------
  159. Option Explicit
  160. Private Declare Function GetKeyState Lib "User" (ByVal nVirtKey As Integer) As Integer
  161.  
  162. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  163.     Dim temp As Integer, ind As Integer
  164.  
  165.     Select Case KeyCode
  166.         Case KEY_TAB:
  167.             If (Shift And SHIFT_MASK) > 0 Then
  168.                 PromoteItem
  169.             Else
  170.                 DemoteItem
  171.             End If
  172.             Text1.SetFocus
  173.         Case KEY_DOWN
  174.             If (Shift And CTRL_MASK) > 0 Then
  175.                 movedown
  176.                 UpdateFields
  177.             ElseIf Outline1.ListIndex < (Outline1.ListCount - 1) Then
  178.                 Outline1.ListIndex = Outline1.ListIndex + 1
  179.                 UpdateFields
  180.             Else
  181.                 Beep
  182.             End If
  183.         Case KEY_BACK
  184.             If Text1.Text = "" Then
  185.                 temp = Outline1.ListIndex
  186.                 mnuCommandItem_click DeleteBranch
  187.                 If Outline1.ListCount > 0 Then Outline1.ListIndex = temp - 1
  188.                 UpdateFields
  189.             Else
  190.                 If Outline1.ListIndex <> -1 Then
  191.                     Outline1.List(Outline1.ListIndex) = Text1.Text
  192.                     Outline1.Refresh
  193.                     SuperExpand (Outline1.ListIndex)
  194.                 Else
  195.                     Beep
  196.                 End If
  197.             End If
  198.         Case KEY_RETURN
  199.             ind = Outline1.ListIndex
  200.             If Outline1.ListIndex <> -1 Then
  201.                 If Outline1.List(ind) <> "" Then
  202.                     Outline1.AddItem ""
  203.                     Outline1.ListIndex = Outline1.ListIndex + 1
  204.                     If Outline1.Indent(Outline1.ListIndex) > 1 Then
  205.                         Outline1.Indent(Outline1.ListIndex) = Outline1.Indent(Outline1.ListIndex - 1)
  206.                     End If
  207.                 Else
  208.                     Beep
  209.                 End If
  210.             Else
  211.                 Beep
  212.                 Outline1.AddItem ""
  213.                 Outline1.Indent(0) = 0
  214.                 Outline1.ListIndex = Outline1.ListCount - 1
  215.             End If
  216.             UpdateFields
  217.             Outline1.Refresh
  218.             SuperExpand (Outline1.ListIndex)
  219.     End Select
  220. End Sub
  221.  
  222. Private Sub Form_KeyPress(KeyAscii As Integer)
  223. '------------------------------------------------------------------------------------------------
  224. '------------------------------------------------------------------------------------------------
  225. '-- Some keystrokes causes the system to beep, avoid beep by intercepting
  226. '-- the enter key.
  227.     
  228.     Select Case KeyAscii
  229.         Case KEY_RETURN:
  230.             KeyAscii = 0
  231.         Case KEY_TAB:
  232.             KeyAscii = 0
  233.     End Select
  234. End Sub
  235.  
  236. Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
  237.    
  238.  
  239.     Select Case KeyCode
  240.         Case KEY_LEFT
  241.             If (Shift And CTRL_MASK) > 0 Then mnuCommandItem_click Promote
  242.         Case KEY_RIGHT
  243.             If (Shift And CTRL_MASK) > 0 Then
  244.                 If (Shift And ALT_MASK) > 0 Then
  245.                     mnuCommandItem_click DeleteBranch
  246.                 Else
  247.                     mnuCommandItem_click Demote
  248.                 End If
  249.             End If
  250.         Case KEY_UP
  251.             If (Shift And CTRL_MASK) > 0 Then
  252.                 moveup
  253.                 UpdateFields
  254.             ElseIf Outline1.ListIndex <> 0 Then
  255.                 Outline1.ListIndex = Outline1.ListIndex - 1
  256.                 UpdateFields
  257.             Else
  258.                 Beep
  259.             End If
  260.         Case Else
  261.             If Outline1.ListIndex <> -1 Then
  262.                 Outline1.List(Outline1.ListIndex) = Text1.Text
  263.                 Outline1.Refresh
  264.                 SuperExpand (Outline1.ListIndex)
  265.             Else
  266.                 Beep
  267.                 Text1.Text = ""
  268.             End If
  269.     End Select
  270. End Sub
  271.  
  272. Private Sub Form_Load()
  273.     frmOrgChart.Outline1.AddItem ""
  274.     Outline1.ListIndex = 0
  275.     Outline1.Indent(Outline1.ListIndex) = 0
  276.     UpdateFields
  277. End Sub
  278.  
  279. Private Sub mnuChartItem_Click(Index As Integer)
  280. '------------------------------------------------------------------------------------------------
  281. '------------------------------------------------------------------------------------------------
  282. '-- The three menu items in the menu Chart
  283. '--
  284.     Dim strMsg As String
  285.     
  286.     Select Case Index
  287.         Case ShowItems:
  288.             If Not mnuChartItem(ShowItems).Checked Then TopExpand (0)
  289.             mnuChartItem(ShowItems).Checked = Not mnuChartItem(ShowItems).Checked
  290.         Case CreateChart:
  291.             If Outline1.ListCount > 0 Then
  292.                 CreateOrgChart
  293.             Else
  294.                 Beep
  295.             End If
  296.         Case ReadChart:
  297.             If Not (frmOrgChart.Outline1.ListCount <> 0 And frmOrgChart.Outline1.List(0) = "") Then
  298.                 strMsg = "Continuing will erase current orgchart, continue?"
  299.                 If MsgBox(strMsg, MB_YESNO, "OrgChart") = IDNO Then
  300.                     Exit Sub
  301.                 Else
  302.                     frmOrgChart.Text1.Text = ""
  303.                     frmOrgChart.Outline1.Clear
  304.                 End If
  305.             End If
  306.             ReadOrgChart
  307.     End Select
  308. End Sub
  309.  
  310. Private Sub mnuCommandItem_click(Index As Integer)
  311. '-- Then four menu items in the menu Command
  312.     
  313.     Select Case Index
  314.         Case Promote:
  315.             PromoteItem
  316.         Case Demote:
  317.             DemoteItem
  318.         Case Delet:
  319.             DeleteItem
  320.         Case DeleteBranch:
  321.             DeleteItemBranch
  322.     End Select
  323. End Sub
  324.  
  325. Private Sub Outline1_Click()
  326.     UpdateFields
  327.     Text1.SetFocus
  328. End Sub
  329.  
  330. Private Sub Outline1_Collapse(ListIndex As Integer)
  331.     If frmOrgChart.mnuChartItem(ShowItems).Checked Then
  332.         TopExpand (ListIndex)
  333.     End If
  334.     Text1.SetFocus
  335. End Sub
  336.  
  337. Private Sub Outline1_DblClick()
  338.     TopExpand (Outline1.ListIndex)
  339.     Text1.SetFocus
  340. End Sub
  341.  
  342.