home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / Outlook_2K2097081112008.psc / Buttons.pag < prev    next >
Text File  |  2008-01-01  |  17KB  |  592 lines

  1. VERSION 5.00
  2. Begin VB.PropertyPage Buttons 
  3.    Caption         =   "Buttons"
  4.    ClientHeight    =   3495
  5.    ClientLeft      =   0
  6.    ClientTop       =   0
  7.    ClientWidth     =   5925
  8.    PaletteMode     =   0  'Halftone
  9.    ScaleHeight     =   3495
  10.    ScaleWidth      =   5925
  11.    Begin VB.CheckBox chkVisible 
  12.       Caption         =   "&Visible"
  13.       Height          =   240
  14.       Left            =   1155
  15.       TabIndex        =   28
  16.       Tag             =   "E"
  17.       Top             =   2760
  18.       Width           =   1140
  19.    End
  20.    Begin VB.Frame Frame2 
  21.       Caption         =   "&Small Icon"
  22.       Enabled         =   0   'False
  23.       Height          =   870
  24.       Left            =   4080
  25.       TabIndex        =   24
  26.       Tag             =   "E"
  27.       Top             =   2520
  28.       Width           =   1680
  29.       Begin VB.PictureBox picImg 
  30.          AutoRedraw      =   -1  'True
  31.          AutoSize        =   -1  'True
  32.          BorderStyle     =   0  'None
  33.          Enabled         =   0   'False
  34.          Height          =   480
  35.          Index           =   0
  36.          Left            =   180
  37.          ScaleHeight     =   32
  38.          ScaleMode       =   3  'Pixel
  39.          ScaleWidth      =   32
  40.          TabIndex        =   27
  41.          TabStop         =   0   'False
  42.          Top             =   270
  43.          Width           =   480
  44.       End
  45.       Begin VB.CommandButton btnBrowse 
  46.          Height          =   375
  47.          Index           =   0
  48.          Left            =   765
  49.          Picture         =   "Buttons.pgx":0000
  50.          Style           =   1  'Graphical
  51.          TabIndex        =   26
  52.          Tag             =   "E"
  53.          ToolTipText     =   "Browse Picture"
  54.          Top             =   315
  55.          Width           =   375
  56.       End
  57.       Begin VB.CommandButton btnClear 
  58.          Height          =   375
  59.          Index           =   0
  60.          Left            =   1140
  61.          Picture         =   "Buttons.pgx":014A
  62.          Style           =   1  'Graphical
  63.          TabIndex        =   25
  64.          Tag             =   "E"
  65.          ToolTipText     =   "Clear Picture"
  66.          Top             =   315
  67.          Width           =   375
  68.       End
  69.    End
  70.    Begin VB.CommandButton btnAction 
  71.       Caption         =   "Swap..."
  72.       Height          =   375
  73.       Index           =   4
  74.       Left            =   4425
  75.       TabIndex        =   18
  76.       Tag             =   "E"
  77.       ToolTipText     =   "Move Button to specified location"
  78.       Top             =   120
  79.       Width           =   1320
  80.    End
  81.    Begin VB.CommandButton btnAction 
  82.       Height          =   375
  83.       Index           =   3
  84.       Left            =   3930
  85.       Picture         =   "Buttons.pgx":0294
  86.       Style           =   1  'Graphical
  87.       TabIndex        =   17
  88.       Tag             =   "E"
  89.       ToolTipText     =   "Move Button Right"
  90.       Top             =   120
  91.       Width           =   375
  92.    End
  93.    Begin VB.CommandButton btnAction 
  94.       Height          =   375
  95.       Index           =   2
  96.       Left            =   3570
  97.       Picture         =   "Buttons.pgx":03DE
  98.       Style           =   1  'Graphical
  99.       TabIndex        =   16
  100.       Tag             =   "E"
  101.       ToolTipText     =   "Move Button Left"
  102.       Top             =   120
  103.       Width           =   375
  104.    End
  105.    Begin VB.CommandButton btnAction 
  106.       Caption         =   "&Insert"
  107.       Height          =   375
  108.       Index           =   0
  109.       Left            =   2130
  110.       TabIndex        =   15
  111.       ToolTipText     =   "Add Button"
  112.       Top             =   120
  113.       Width           =   1050
  114.    End
  115.    Begin VB.CommandButton btnAction 
  116.       Height          =   375
  117.       Index           =   1
  118.       Left            =   3180
  119.       Picture         =   "Buttons.pgx":0528
  120.       Style           =   1  'Graphical
  121.       TabIndex        =   14
  122.       Tag             =   "E"
  123.       ToolTipText     =   "Remove Button"
  124.       Top             =   120
  125.       Width           =   375
  126.    End
  127.    Begin VB.TextBox txtField 
  128.       BackColor       =   &H80000014&
  129.       Height          =   285
  130.       Index           =   0
  131.       Left            =   660
  132.       Locked          =   -1  'True
  133.       TabIndex        =   13
  134.       TabStop         =   0   'False
  135.       Tag             =   "E"
  136.       Top             =   165
  137.       Width           =   690
  138.    End
  139.    Begin VB.HScrollBar hsbIDX 
  140.       Height          =   285
  141.       Left            =   1425
  142.       Max             =   1
  143.       Min             =   1
  144.       TabIndex        =   12
  145.       TabStop         =   0   'False
  146.       Tag             =   "E"
  147.       Top             =   165
  148.       Value           =   1
  149.       Width           =   465
  150.    End
  151.    Begin VB.TextBox txtField 
  152.       Height          =   285
  153.       Index           =   1
  154.       Left            =   1155
  155.       TabIndex        =   11
  156.       Tag             =   "E"
  157.       Top             =   1065
  158.       Width           =   1320
  159.    End
  160.    Begin VB.TextBox txtField 
  161.       Height          =   285
  162.       Index           =   2
  163.       Left            =   1155
  164.       TabIndex        =   10
  165.       Tag             =   "E"
  166.       Top             =   1425
  167.       Width           =   1320
  168.    End
  169.    Begin VB.TextBox txtField 
  170.       Height          =   285
  171.       Index           =   3
  172.       Left            =   1155
  173.       TabIndex        =   9
  174.       Tag             =   "E"
  175.       Top             =   2145
  176.       Width           =   2490
  177.    End
  178.    Begin VB.Frame Frame1 
  179.       Enabled         =   0   'False
  180.       Height          =   870
  181.       Left            =   3510
  182.       TabIndex        =   5
  183.       Tag             =   "E"
  184.       Top             =   660
  185.       Width           =   2220
  186.       Begin VB.CommandButton cmdBrowse 
  187.          Caption         =   "..."
  188.          Enabled         =   0   'False
  189.          Height          =   285
  190.          Left            =   1500
  191.          Style           =   1  'Graphical
  192.          TabIndex        =   7
  193.          Tag             =   "E"
  194.          Top             =   360
  195.          Width           =   285
  196.       End
  197.       Begin VB.CheckBox chkUseMask 
  198.          Caption         =   "&UseMaskColor"
  199.          Enabled         =   0   'False
  200.          Height          =   285
  201.          Left            =   180
  202.          TabIndex        =   6
  203.          Tag             =   "E"
  204.          Top             =   0
  205.          Width           =   1365
  206.       End
  207.       Begin VB.Shape shpCol 
  208.          FillColor       =   &H00FF00FF&
  209.          FillStyle       =   0  'Solid
  210.          Height          =   285
  211.          Left            =   945
  212.          Top             =   360
  213.          Width           =   555
  214.       End
  215.       Begin VB.Label lblHdr 
  216.          AutoSize        =   -1  'True
  217.          Caption         =   "C&olour:"
  218.          Enabled         =   0   'False
  219.          Height          =   195
  220.          Index           =   5
  221.          Left            =   315
  222.          TabIndex        =   8
  223.          Tag             =   "E"
  224.          Top             =   405
  225.          Width           =   495
  226.       End
  227.    End
  228.    Begin VB.Frame Frame3 
  229.       Caption         =   "&Icon"
  230.       Enabled         =   0   'False
  231.       Height          =   870
  232.       Left            =   4080
  233.       TabIndex        =   1
  234.       Tag             =   "E"
  235.       Top             =   1560
  236.       Width           =   1680
  237.       Begin VB.CommandButton btnClear 
  238.          Height          =   375
  239.          Index           =   1
  240.          Left            =   1140
  241.          Picture         =   "Buttons.pgx":0672
  242.          Style           =   1  'Graphical
  243.          TabIndex        =   4
  244.          Tag             =   "E"
  245.          ToolTipText     =   "Clear Picture"
  246.          Top             =   315
  247.          Width           =   375
  248.       End
  249.       Begin VB.CommandButton btnBrowse 
  250.          Height          =   375
  251.          Index           =   1
  252.          Left            =   765
  253.          Picture         =   "Buttons.pgx":07BC
  254.          Style           =   1  'Graphical
  255.          TabIndex        =   3
  256.          Tag             =   "E"
  257.          ToolTipText     =   "Browse Picture"
  258.          Top             =   315
  259.          Width           =   375
  260.       End
  261.       Begin VB.PictureBox picImg 
  262.          AutoRedraw      =   -1  'True
  263.          AutoSize        =   -1  'True
  264.          BorderStyle     =   0  'None
  265.          Enabled         =   0   'False
  266.          Height          =   480
  267.          Index           =   1
  268.          Left            =   180
  269.          ScaleHeight     =   32
  270.          ScaleMode       =   3  'Pixel
  271.          ScaleWidth      =   32
  272.          TabIndex        =   2
  273.          TabStop         =   0   'False
  274.          Top             =   270
  275.          Width           =   480
  276.       End
  277.    End
  278.    Begin VB.TextBox txtField 
  279.       Height          =   285
  280.       Index           =   5
  281.       Left            =   1155
  282.       TabIndex        =   0
  283.       Tag             =   "E"
  284.       Top             =   1785
  285.       Width           =   2490
  286.    End
  287.    Begin VB.Label lblHdr 
  288.       AutoSize        =   -1  'True
  289.       Caption         =   "Index:"
  290.       Height          =   195
  291.       Index           =   0
  292.       Left            =   120
  293.       TabIndex        =   23
  294.       Top             =   210
  295.       Width           =   435
  296.    End
  297.    Begin VB.Label lblHdr 
  298.       AutoSize        =   -1  'True
  299.       Caption         =   "&Key:"
  300.       Height          =   195
  301.       Index           =   2
  302.       Left            =   120
  303.       TabIndex        =   22
  304.       Tag             =   "E"
  305.       Top             =   1110
  306.       Width           =   315
  307.    End
  308.    Begin VB.Label lblHdr 
  309.       AutoSize        =   -1  'True
  310.       Caption         =   "&Caption:"
  311.       Height          =   195
  312.       Index           =   3
  313.       Left            =   120
  314.       TabIndex        =   21
  315.       Tag             =   "E"
  316.       Top             =   1470
  317.       Width           =   585
  318.    End
  319.    Begin VB.Label lblHdr 
  320.       AutoSize        =   -1  'True
  321.       Caption         =   "&ToolTipText:"
  322.       Height          =   195
  323.       Index           =   4
  324.       Left            =   120
  325.       TabIndex        =   20
  326.       Tag             =   "E"
  327.       Top             =   2190
  328.       Width           =   900
  329.    End
  330.    Begin VB.Label lblHdr 
  331.       AutoSize        =   -1  'True
  332.       Caption         =   "&Description:"
  333.       Height          =   195
  334.       Index           =   7
  335.       Left            =   120
  336.       TabIndex        =   19
  337.       Tag             =   "E"
  338.       Top             =   1830
  339.       Width           =   840
  340.    End
  341. End
  342. Attribute VB_Name = "Buttons"
  343. Attribute VB_GlobalNameSpace = False
  344. Attribute VB_Creatable = True
  345. Attribute VB_PredeclaredId = False
  346. Attribute VB_Exposed = True
  347. Option Explicit
  348. DefInt A-Z
  349.  
  350. Dim NP As NavPane
  351. Dim LastBtn
  352.  
  353. Private Sub ClearField()
  354.   txtField(1) = ""
  355.   txtField(2) = ""
  356.   txtField(3) = ""
  357.   txtField(5) = ""
  358.   chkUseMask = 0
  359. End Sub
  360.  
  361. Private Sub btnAction_Click(Index As Integer)
  362.   Dim i, Z, x
  363.   Dim M$
  364.   Z = hsbIDX
  365.   Select Case Index
  366.     Case 0: GoSub AddButton
  367.     Case 1: GoSub DelButton
  368.     Case 2: GoSub MoveLeft
  369.     Case 3: GoSub MoveRight
  370.     Case 4: GoSub MoveX
  371.   End Select
  372.   Exit Sub
  373.  
  374. AddButton:
  375.   If Changed Then PropertyPage_ApplyChanges
  376.   i = NP.AddButton()
  377.   If i > 0 Then
  378.     hsbIDX.Max = i
  379.     hsbIDX = i
  380.     Call hsbIDX_Change
  381.     If NP.ExpandedButtons = i - 1 Then NP.ExpandedButtons = i
  382.   Else
  383.     MsgBox "Unable to add button", vbCritical
  384.   End If
  385.   Changed = -1
  386.   Return
  387.  
  388. DelButton:
  389.   Changed = 0
  390.   i = NP.RemoveButton(Z)
  391.   hsbIDX.Max = i
  392.   If i >= 0 Then
  393.     If NP.ButtonCount = 0 Then
  394.       ClearField
  395.       SetTagControls
  396.     Else
  397.       hsbIDX.Max = i
  398.       If Z >= i Then
  399.        hsbIDX = i
  400.       Else
  401.        hsbIDX = Z
  402.       End If
  403.       hsbIDX_Change
  404.       Changed = -1
  405.     End If
  406.   ElseIf i = -1 Then
  407.     MsgBox "Unable to delete button", vbCritical
  408.   End If
  409.   Return
  410.  
  411. MoveLeft:
  412.   i = hsbIDX
  413.   If i > 1 Then
  414.     PropertyPage_ApplyChanges
  415.     Z = NP.SwapButton(i, i - 1)
  416.     If Z Then LastBtn = Z: hsbIDX = Z
  417.     Changed = -1
  418.   Else
  419.     MsgBox "Button cannot be moved any further left.", 48
  420.   End If
  421.   Return
  422.  
  423. MoveRight:
  424.   i = hsbIDX
  425.   If i < NP.ButtonCount Then
  426.     PropertyPage_ApplyChanges
  427.     Z = NP.SwapButton(i, i + 1)
  428.     If Z Then LastBtn = Z: hsbIDX = Z
  429.     Changed = -1
  430.   Else
  431.     MsgBox "Button cannot be moved any further right.", 48
  432.   End If
  433.   Return
  434.  
  435. MoveX:
  436.   Z = hsbIDX.Max
  437.   x = hsbIDX
  438.   M$ = InputBox$("Swap Button " & x & " with which index?" & Chr$(10) & Chr$(10) & "Plese select a position between 1 and " & Z, "Swap Button")
  439.   If M$ <> "" Then
  440.     i = Val(M$)
  441.     If i < 1 Or i > Z Then
  442.       MsgBox "Value entered out of range.", vbExclamation
  443.     Else
  444.       PropertyPage_ApplyChanges
  445.       Z = NP.SwapButton(hsbIDX, i)
  446.       If Z Then LastBtn = Z: hsbIDX = Z
  447.       Changed = -1
  448.     End If
  449.   End If
  450.   Return
  451. End Sub
  452.  
  453. Private Sub btnBrowse_Click(Index As Integer)
  454.   Dim F$
  455.   F$ = SelectFile$(hwnd, "Browse Picture", "Pictures (*.bmp;*.dib;*.gif;*.ico;*.jpg;*.rle)|*.bmp;*.dib;*.gif;*.ico;*.jpg;*.rle|All Files (*.*)|*.*", 0, "", "", "BMP", fdmOpenFile)
  456.   If F$ <> "" Then
  457.     On Error Resume Next
  458.     picImg(Index).BackColor = shpCol.FillColor
  459.     picImg(Index).Picture = LoadPicture(F$)
  460.     picImg(Index).Picture = picImg(Index).Image
  461.     Changed = -1
  462.     If Err Then MsgBox Error$, vbExclamation
  463.     On Error GoTo 0
  464.   End If
  465. End Sub
  466.  
  467. Private Sub btnClear_Click(Index As Integer)
  468.   Set picImg(Index).Picture = Nothing
  469.   Changed = -1
  470. End Sub
  471.  
  472. Private Sub chkVisible_Click()
  473.   Changed = True
  474. End Sub
  475.  
  476. Private Sub cmdBrowse_Click()
  477.   Dim C As Long
  478.   C = SelectColor(hwnd, shpCol.FillColor, 0)
  479.   If C <> -1 Then
  480.     shpCol.FillColor = C
  481.     picImg(1).BackColor = C
  482.     Changed = -1
  483.   End If
  484. End Sub
  485.  
  486. Private Sub hsbIDX_Change()
  487.   Dim i
  488.   Dim L As Boolean, R As Boolean
  489.   i = hsbIDX
  490.   If i <> LastBtn And Changed = -1 Then PropertyPage_ApplyChanges
  491.   LastBtn = i
  492.   With NP
  493.     txtField(0) = i
  494.     If .ButtonCount >= i Then
  495.       SetTagControls , -1
  496.       If i = 1 Then L = 0 Else L = -1
  497.       If i = .ButtonCount Then R = 0 Else R = -1
  498.       btnAction(2).Enabled = L
  499.       btnAction(3).Enabled = R
  500.       txtField(1) = .ButtonKey(i)
  501.       txtField(2) = .ButtonCaption(i)
  502.       txtField(3) = .ButtonToolTipText(i)
  503.       txtField(5) = .ButtonDescription(i)
  504.       chkUseMask = Abs(.ButtonUseMaskColor(i))
  505.       chkVisible = Abs(.ButtonVisible(i))
  506.       shpCol.FillColor = .ButtonMaskColor(i)
  507.       Set picImg(1).Picture = .ButtonIcon(i)
  508.       Set picImg(0).Picture = .ButtonSmallIcon(i)
  509.       Changed = 0
  510.     Else
  511.       MsgBox "Button index '" & i & "' not found.", vbCritical
  512.       SetTagControls
  513.     End If
  514.   End With
  515. End Sub
  516.  
  517. Private Sub hsbIDX_Scroll()
  518.   hsbIDX_Change
  519. End Sub
  520.  
  521. Private Sub PropertyPage_ApplyChanges()
  522.   Dim i
  523.   With NP
  524.     i = LastBtn
  525.     If i <= .ButtonCount Then
  526.       .Redraw = 0
  527.       .ButtonKey(i) = txtField(1)
  528.       .ButtonCaption(i) = txtField(2)
  529.       .ButtonToolTipText(i) = txtField(3)
  530.       .ButtonDescription(i) = txtField(5)
  531.       .ButtonUseMaskColor(i) = chkUseMask
  532.       .ButtonVisible(i) = chkVisible
  533.       .ButtonMaskColor(i) = shpCol.FillColor
  534.       Set .ButtonIcon(i) = picImg(1).Picture
  535.       Set .ButtonSmallIcon(i) = picImg(0).Picture
  536.       .Redraw = 1
  537.       .Refresh
  538.     End If
  539.   End With
  540. End Sub
  541.  
  542. Private Sub PropertyPage_SelectionChanged()
  543.   If TypeOf SelectedControls(0) Is NavPane Then
  544.     If NP Is Nothing Then
  545.       GoSub LoadProperties
  546.     ElseIf NP.hwnd <> SelectedControls(0).hwnd Then
  547.       GoSub LoadProperties
  548.     End If
  549.   End If
  550.   Exit Sub
  551.   
  552. LoadProperties:
  553.   Set NP = SelectedControls(0)
  554.   If NP.ButtonCount Then
  555.     hsbIDX.Max = NP.ButtonCount
  556.     hsbIDX_Change
  557.   Else
  558.     SetTagControls
  559.   End If
  560.   Changed = 0
  561.   Return
  562. End Sub
  563.  
  564. Private Sub SetTagControls(Optional T$ = "E", Optional V As Boolean = 0)
  565.   Dim i
  566.   Dim C As Control
  567.   On Error Resume Next
  568.     For Each C In Controls
  569.       If C.Tag = T$ Then C.Enabled = V
  570.     Next
  571.   On Error GoTo 0
  572. End Sub
  573.  
  574. Private Sub txtField_Change(Index As Integer)
  575.   If Index <> 0 Then Changed = -1
  576. End Sub
  577.  
  578. Private Sub txtField_GotFocus(Index As Integer)
  579.   Highlight txtField(Index)
  580. End Sub
  581.  
  582. Private Sub txtField_KeyPress(Index As Integer, KeyAscii As Integer)
  583.   Dim C$
  584.   If Index = 4 Or Index = 6 Then
  585.     C$ = Chr$(KeyAscii)
  586.     If C$ < "0" Or C$ > "9" Then
  587.       If KeyAscii <> 8 Then Beep: KeyAscii = 0
  588.     End If
  589.   End If
  590. End Sub
  591.  
  592.