home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 June / Chip_2002-06_cd1.bin / zkuste / vbasic / Data / Utils / fstrip5.exe / %MAINDIR% / FlatTabsCollection.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2002-04-18  |  12.1 KB  |  316 lines

  1. VERSION 5.00
  2. Object = "{9973B72E-F1FF-4E96-AA76-225706910672}#4.8#0"; "FlatStrip5.ocx"
  3. Begin VB.Form frmFlatTabsCollection 
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "FlatTabs Collection Demonstration"
  6.    ClientHeight    =   4920
  7.    ClientLeft      =   45
  8.    ClientTop       =   330
  9.    ClientWidth     =   7320
  10.    BeginProperty Font 
  11.       Name            =   "Tahoma"
  12.       Size            =   8.25
  13.       Charset         =   0
  14.       Weight          =   400
  15.       Underline       =   0   'False
  16.       Italic          =   0   'False
  17.       Strikethrough   =   0   'False
  18.    EndProperty
  19.    Icon            =   "FlatTabsCollection.frx":0000
  20.    LinkTopic       =   "Form1"
  21.    MaxButton       =   0   'False
  22.    MinButton       =   0   'False
  23.    ScaleHeight     =   328
  24.    ScaleMode       =   3  'Pixel
  25.    ScaleWidth      =   488
  26.    ShowInTaskbar   =   0   'False
  27.    StartUpPosition =   2  'CenterScreen
  28.    Begin VB.CommandButton cmdAction 
  29.       Caption         =   "&MoveTo"
  30.       Height          =   330
  31.       Index           =   10
  32.       Left            =   2655
  33.       TabIndex        =   10
  34.       Tag             =   "The MoveTo method moves the source item to the positon after the destination item"
  35.       Top             =   2835
  36.       Width           =   1140
  37.    End
  38.    Begin FlatStripDemonstration.pucTextTip tipHelp 
  39.       Height          =   1545
  40.       Left            =   5130
  41.       TabIndex        =   13
  42.       Top             =   2025
  43.       Width           =   1995
  44.       _ExtentX        =   3519
  45.       _ExtentY        =   2725
  46.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  47.          Name            =   "Tahoma"
  48.          Size            =   8.25
  49.          Charset         =   0
  50.          Weight          =   400
  51.          Underline       =   0   'False
  52.          Italic          =   0   'False
  53.          Strikethrough   =   0   'False
  54.       EndProperty
  55.    End
  56.    Begin VB.CommandButton cmdAction 
  57.       Caption         =   "&KeyToIndex"
  58.       Height          =   330
  59.       Index           =   9
  60.       Left            =   1440
  61.       TabIndex        =   7
  62.       Tag             =   "The KeyToIndex function will return the Index of a FlatTab identified by Index or Key"
  63.       Top             =   3240
  64.       Width           =   1140
  65.    End
  66.    Begin VB.CommandButton cmdAction 
  67.       Caption         =   "&Parent"
  68.       Height          =   330
  69.       Index           =   8
  70.       Left            =   3870
  71.       TabIndex        =   11
  72.       Tag             =   "The Parent property returns a reference to the parent FlatStrip control this collection belongs to, or Nothing if not attached."
  73.       Top             =   2025
  74.       Width           =   1140
  75.    End
  76.    Begin VB.CommandButton cmdAction 
  77.       Caption         =   "Cl&ear"
  78.       Height          =   330
  79.       Index           =   7
  80.       Left            =   225
  81.       TabIndex        =   3
  82.       Tag             =   "The Clear method removes all FlatTab objects"
  83.       Top             =   2835
  84.       Width           =   1140
  85.    End
  86.    Begin VB.CommandButton cmdAction 
  87.       Caption         =   "&SwapItem"
  88.       Height          =   330
  89.       Index           =   6
  90.       Left            =   2655
  91.       TabIndex        =   9
  92.       Tag             =   "The Swap method swaps the contents of two FlatTab objects with each other"
  93.       Top             =   2430
  94.       Width           =   1140
  95.    End
  96.    Begin VB.CommandButton cmdAction 
  97.       Caption         =   "Cl&oneItem"
  98.       Height          =   330
  99.       Index           =   5
  100.       Left            =   2655
  101.       TabIndex        =   8
  102.       Tag             =   "The CloneItem method copies the contents of of FlatTab object into another"
  103.       Top             =   2025
  104.       Width           =   1140
  105.    End
  106.    Begin VB.CommandButton cmdAction 
  107.       Caption         =   "&Count"
  108.       Height          =   330
  109.       Index           =   4
  110.       Left            =   1440
  111.       TabIndex        =   4
  112.       Tag             =   "The Count property returns the total number of FlatTabs in the collection"
  113.       Top             =   2025
  114.       Width           =   1140
  115.    End
  116.    Begin VB.CommandButton cmdAction 
  117.       Caption         =   "E&numeration"
  118.       Height          =   330
  119.       Index           =   3
  120.       Left            =   1440
  121.       TabIndex        =   6
  122.       Tag             =   "This is not actually a property, but rather a feature - you can enumerate through all items in the collection."
  123.       Top             =   2835
  124.       Width           =   1140
  125.    End
  126.    Begin VB.CommandButton cmdAction 
  127.       Caption         =   "&Item"
  128.       Height          =   330
  129.       Index           =   2
  130.       Left            =   1440
  131.       TabIndex        =   5
  132.       Tag             =   "The Item property returns a reference to a single FlatTab object"
  133.       Top             =   2430
  134.       Width           =   1140
  135.    End
  136.    Begin VB.CommandButton cmdAction 
  137.       Caption         =   "&Remove"
  138.       Height          =   330
  139.       Index           =   1
  140.       Left            =   225
  141.       TabIndex        =   2
  142.       Tag             =   "The Remove method removes an existing FlatTab object"
  143.       Top             =   2430
  144.       Width           =   1140
  145.    End
  146.    Begin VB.CommandButton cmdAction 
  147.       Caption         =   "&Add"
  148.       Height          =   330
  149.       Index           =   0
  150.       Left            =   225
  151.       TabIndex        =   1
  152.       Tag             =   "The Add function adds a new FlatTab to the collection and returns it."
  153.       Top             =   2025
  154.       Width           =   1140
  155.    End
  156.    Begin VB.CommandButton cmdClose 
  157.       Cancel          =   -1  'True
  158.       Caption         =   "C&lose"
  159.       Default         =   -1  'True
  160.       Height          =   330
  161.       Left            =   5985
  162.       TabIndex        =   12
  163.       Top             =   3735
  164.       Width           =   1140
  165.    End
  166.    Begin FlatStripCtl.FlatStrip ftsDemo 
  167.       Height          =   420
  168.       Left            =   180
  169.       Top             =   4275
  170.       Width           =   6945
  171.       _ExtentX        =   12250
  172.       _ExtentY        =   741
  173.       ShowClientArea  =   0   'False
  174.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  175.          Name            =   "Tahoma"
  176.          Size            =   8.25
  177.          Charset         =   0
  178.          Weight          =   400
  179.          Underline       =   0   'False
  180.          Italic          =   0   'False
  181.          Strikethrough   =   0   'False
  182.       EndProperty
  183.    End
  184.    Begin FlatStripDemonstration.pucTextTip pucTextTip1 
  185.       Height          =   960
  186.       Left            =   180
  187.       TabIndex        =   0
  188.       Top             =   900
  189.       Width           =   6945
  190.       _ExtentX        =   12250
  191.       _ExtentY        =   1693
  192.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  193.          Name            =   "Tahoma"
  194.          Size            =   8.25
  195.          Charset         =   0
  196.          Weight          =   400
  197.          Underline       =   0   'False
  198.          Italic          =   0   'False
  199.          Strikethrough   =   0   'False
  200.       EndProperty
  201.       Text            =   $"FlatTabsCollection.frx":014A
  202.    End
  203.    Begin FlatStripDemonstration.pucLogoPane pucLogoPane1 
  204.       Align           =   1  'Align Top
  205.       Height          =   750
  206.       Left            =   0
  207.       Top             =   0
  208.       Width           =   7320
  209.       _ExtentX        =   12912
  210.       _ExtentY        =   1323
  211.       Picture         =   "FlatTabsCollection.frx":026F
  212.    End
  213. Attribute VB_Name = "frmFlatTabsCollection"
  214. Attribute VB_GlobalNameSpace = False
  215. Attribute VB_Creatable = False
  216. Attribute VB_PredeclaredId = True
  217. Attribute VB_Exposed = False
  218. Option Explicit
  219. Private Sub cmdAction_Click(Index As Integer)
  220.     Dim FlatTab       As FlatStripCtl.FlatTab
  221.     Dim Browse      As frmSelectItems
  222.     Dim Return1     As String
  223.     Dim Return2     As String
  224.     Select Case Index
  225.         Case 0
  226.             'add
  227.             Return1 = InputBox("Enter the Text of your new FlatTab:", "Add")
  228.             If Len(Return1) Then
  229.                 ftsDemo.FlatTabs.Add , "!" & (Int(Rnd * 10000) + Int(Rnd * 10000)), Return1
  230.             End If
  231.         Case 1
  232.             'remove
  233.             Set Browse = New frmSelectItems
  234.             If Browse.SelectItem(ftsDemo, "Remove Item", "Item to &remove:", "", Return1, Return2) Then
  235.                 ftsDemo.FlatTabs.Remove Return1
  236.             End If
  237.         Case 2
  238.             'item
  239.             Set Browse = New frmSelectItems
  240.             If Browse.SelectItem(ftsDemo, "Query Item", "Item to &query:", "", Return1, Return2) Then
  241.                 With ftsDemo.FlatTabs(Return1)
  242.                     MsgBox "The Index of the FlatTab you selected is " & .Index & " and it's dimensions are:" & vbCr & vbCr & _
  243.                            "Left: " & .Left & vbCr & _
  244.                            "Top: " & .Top & vbCr & _
  245.                            "Width: " & .Width & vbCr & _
  246.                            "Height: " & .Height & vbCr & vbCr & _
  247.                            IIf(.Selected, "Tab is selected", "Tab is not selected") _
  248.                            , vbInformation
  249.                 End With
  250.             End If
  251.         Case 3
  252.             'newenum
  253.             For Each FlatTab In ftsDemo.FlatTabs
  254.                 Return1 = Return1 & FlatTab.Key & vbCr
  255.             Next
  256.             MsgBox "The Keys of all the FlatTabs in the collection are:" & vbCr & vbCr & Return1, vbInformation
  257.         Case 4
  258.             'count
  259.             MsgBox "There are " & ftsDemo.FlatTabs.Count & " FlatTab objects in the FlatTabs collection.", vbInformation
  260.         Case 5
  261.             'cloneitem
  262.             Set Browse = New frmSelectItems
  263.             If Browse.SelectItem(ftsDemo, "Clone", "&Source FlatTab:", "&Destination FlatTab:", Return1, Return2) Then
  264.                 With ftsDemo.FlatTabs
  265.                     .CloneItem .Item(Return1), .Item(Return2)
  266.                 End With
  267.                 MsgBox "FlatTab '" & Return1 & "' has been cloned into FlatTab '" & Return2 & "'.", vbInformation
  268.             End If
  269.         Case 6
  270.             'swap
  271.             Set Browse = New frmSelectItems
  272.             If Browse.SelectItem(ftsDemo, "Swap", "&Source FlatTab:", "&Destination FlatTab:", Return1, Return2) Then
  273.                 With ftsDemo.FlatTabs
  274.                     .SwapItem .Item(Return1), .Item(Return2)
  275.                 End With
  276.                 MsgBox "FlatTab '" & Return1 & "' has been swapped with FlatTab '" & Return2 & "'.", vbInformation
  277.             End If
  278.         Case 7
  279.             'clear
  280.             If MsgBox("Are you sure you want to clear all items from the collection?", vbYesNo Or vbQuestion) = vbYes Then
  281.                 ftsDemo.FlatTabs.Clear
  282.             End If
  283.         Case 8
  284.             'parent
  285.             MsgBox "The handle of the parent FlatStrip control is '" & ftsDemo.FlatTabs.Parent.hWnd & "'", vbInformation
  286.         Case 9
  287.             'keytoindex
  288.             Set Browse = New frmSelectItems
  289.             If Browse.SelectItem(ftsDemo, "KeyToIndex", "Item to &query:", "", Return1, Return2) Then
  290.                 MsgBox "The return of KeyToIndex on your selected key of '" & Return1 & "' is " & ftsDemo.FlatTabs.KeyToIndex(Return1) & ".", vbInformation
  291.             End If
  292.         Case 10
  293.             'moveto
  294.             Set Browse = New frmSelectItems
  295.             If Browse.SelectItem(ftsDemo, "MoveTo", "&Source FlatTab:", "&Destination FlatTab:", Return1, Return2) Then
  296.                 With ftsDemo.FlatTabs
  297.                     .MoveTo .Item(Return1), .Item(Return2)
  298.                 End With
  299.                 MsgBox "FlatTab '" & Return1 & "' has been moved to the slot after FlatTab '" & Return2 & "'.", vbInformation
  300.             End If
  301.     End Select
  302. End Sub
  303. Private Sub cmdAction_GotFocus(Index As Integer)
  304.     'update the help FlatTab
  305.     tipHelp.Text = cmdAction(Index).Tag
  306. End Sub
  307. Private Sub cmdClose_Click()
  308.     Unload Me
  309. End Sub
  310. Private Sub Form_Load()
  311.     Dim IndexLoop       As Integer
  312.     For IndexLoop = 1 To 5
  313.         ftsDemo.FlatTabs.Add , "FlatTab" & IndexLoop, "FlatTab #" & IndexLoop
  314.     Next
  315. End Sub
  316.