home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 6_2008-2009.ISO / data / zips / Office_20021660510252009.psc / SpecialRibbon / ACPRibbon.ctl
Text File  |  2009-10-25  |  91KB  |  2,697 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
  3. Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomct2.ocx"
  4. Begin VB.UserControl ACPRibbon 
  5.    BackColor       =   &H00404040&
  6.    ClientHeight    =   3705
  7.    ClientLeft      =   0
  8.    ClientTop       =   0
  9.    ClientWidth     =   7095
  10.    EditAtDesignTime=   -1  'True
  11.    BeginProperty Font 
  12.       Name            =   "Tahoma"
  13.       Size            =   8.25
  14.       Charset         =   0
  15.       Weight          =   400
  16.       Underline       =   0   'False
  17.       Italic          =   0   'False
  18.       Strikethrough   =   0   'False
  19.    EndProperty
  20.    KeyPreview      =   -1  'True
  21.    ScaleHeight     =   3705
  22.    ScaleWidth      =   7095
  23.    ToolboxBitmap   =   "ACPRibbon.ctx":0000
  24.    Begin VB.ComboBox cboMenus1 
  25.       Height          =   315
  26.       Left            =   3480
  27.       TabIndex        =   18
  28.       Text            =   "Combo1"
  29.       Top             =   2280
  30.       Visible         =   0   'False
  31.       Width           =   735
  32.    End
  33.    Begin VB.ComboBox cboMenus 
  34.       Height          =   315
  35.       Left            =   2760
  36.       TabIndex        =   17
  37.       Text            =   "Combo1"
  38.       Top             =   2280
  39.       Visible         =   0   'False
  40.       Width           =   735
  41.    End
  42.    Begin MSComctlLib.ProgressBar progBar 
  43.       Height          =   315
  44.       Index           =   0
  45.       Left            =   1440
  46.       TabIndex        =   15
  47.       Top             =   2280
  48.       Visible         =   0   'False
  49.       Width           =   855
  50.       _ExtentX        =   1508
  51.       _ExtentY        =   556
  52.       _Version        =   393216
  53.       BorderStyle     =   1
  54.       Appearance      =   1
  55.       Scrolling       =   1
  56.    End
  57.    Begin VB.ComboBox cboMaster 
  58.       Height          =   315
  59.       Left            =   2760
  60.       TabIndex        =   14
  61.       Text            =   "Combo1"
  62.       Top             =   2640
  63.       Visible         =   0   'False
  64.       Width           =   735
  65.    End
  66.    Begin MSComCtl2.DTPicker datePick 
  67.       Height          =   315
  68.       Index           =   0
  69.       Left            =   5640
  70.       TabIndex        =   13
  71.       Top             =   2400
  72.       Width           =   1335
  73.       _ExtentX        =   2355
  74.       _ExtentY        =   556
  75.       _Version        =   393216
  76.       CustomFormat    =   "dd/mm/yyyy"
  77.       Format          =   120061955
  78.       CurrentDate     =   40111
  79.    End
  80.    Begin VB.ComboBox cboBox 
  81.       Height          =   315
  82.       Index           =   0
  83.       Left            =   6240
  84.       TabIndex        =   12
  85.       Text            =   "Combo1"
  86.       Top             =   3360
  87.       Width           =   735
  88.    End
  89.    Begin VB.TextBox txtBox 
  90.       Height          =   315
  91.       Index           =   0
  92.       Left            =   2400
  93.       TabIndex        =   11
  94.       Top             =   3360
  95.       Visible         =   0   'False
  96.       Width           =   375
  97.    End
  98.    Begin VB.Label Button_Text 
  99.       Alignment       =   2  'Center
  100.       BeginProperty Font 
  101.          Name            =   "Tahoma"
  102.          Size            =   8.25
  103.          Charset         =   0
  104.          Weight          =   700
  105.          Underline       =   0   'False
  106.          Italic          =   0   'False
  107.          Strikethrough   =   0   'False
  108.       EndProperty
  109.       Height          =   495
  110.       Index           =   0
  111.       Left            =   120
  112.       TabIndex        =   16
  113.       Top             =   2160
  114.       Width           =   615
  115.    End
  116.    Begin VB.Label ButMouse 
  117.       Appearance      =   0  'Flat
  118.       BackColor       =   &H80000005&
  119.       BeginProperty Font 
  120.          Name            =   "MS Sans Serif"
  121.          Size            =   8.25
  122.          Charset         =   0
  123.          Weight          =   400
  124.          Underline       =   0   'False
  125.          Italic          =   0   'False
  126.          Strikethrough   =   0   'False
  127.       EndProperty
  128.       ForeColor       =   &H80000008&
  129.       Height          =   990
  130.       Index           =   0
  131.       Left            =   4320
  132.       TabIndex        =   9
  133.       Top             =   2520
  134.       Visible         =   0   'False
  135.       Width           =   375
  136.    End
  137.    Begin VB.Image Glip_on 
  138.       Height          =   60
  139.       Index           =   0
  140.       Left            =   4560
  141.       Top             =   2280
  142.       Visible         =   0   'False
  143.       Width           =   75
  144.    End
  145.    Begin VB.Image Glip_off 
  146.       Height          =   60
  147.       Index           =   0
  148.       Left            =   4440
  149.       Top             =   2280
  150.       Visible         =   0   'False
  151.       Width           =   75
  152.    End
  153.    Begin VB.Image Button_left_over 
  154.       Height          =   990
  155.       Index           =   0
  156.       Left            =   4800
  157.       Top             =   2520
  158.       Visible         =   0   'False
  159.       Width           =   45
  160.    End
  161.    Begin VB.Image Button_center_over 
  162.       Height          =   990
  163.       Index           =   0
  164.       Left            =   4920
  165.       Stretch         =   -1  'True
  166.       Top             =   2520
  167.       Visible         =   0   'False
  168.       Width           =   735
  169.    End
  170.    Begin VB.Image Button_right_over 
  171.       Height          =   990
  172.       Index           =   0
  173.       Left            =   5760
  174.       Top             =   2520
  175.       Visible         =   0   'False
  176.       Width           =   45
  177.    End
  178.    Begin VB.Image Cat_Dlg_over 
  179.       Height          =   210
  180.       Index           =   0
  181.       Left            =   4800
  182.       Top             =   1920
  183.       Visible         =   0   'False
  184.       Width           =   225
  185.    End
  186.    Begin VB.Image Cat_Dlg_on 
  187.       Height          =   210
  188.       Index           =   0
  189.       Left            =   4560
  190.       Top             =   1920
  191.       Visible         =   0   'False
  192.       Width           =   225
  193.    End
  194.    Begin VB.Image Cat_Dlg 
  195.       Height          =   210
  196.       Index           =   0
  197.       Left            =   4320
  198.       Top             =   1920
  199.       Visible         =   0   'False
  200.       Width           =   225
  201.    End
  202.    Begin VB.Image Button_Icon 
  203.       Appearance      =   0  'Flat
  204.       Height          =   495
  205.       Index           =   0
  206.       Left            =   3600
  207.       Top             =   2640
  208.       Visible         =   0   'False
  209.       Width           =   615
  210.    End
  211.    Begin VB.Label Button_Caption 
  212.       Alignment       =   2  'Center
  213.       Appearance      =   0  'Flat
  214.       AutoSize        =   -1  'True
  215.       BackColor       =   &H80000005&
  216.       BackStyle       =   0  'Transparent
  217.       Caption         =   "Label1"
  218.       ForeColor       =   &H80000008&
  219.       Height          =   195
  220.       Index           =   0
  221.       Left            =   3735
  222.       TabIndex        =   10
  223.       Top             =   3240
  224.       Visible         =   0   'False
  225.       Width           =   480
  226.    End
  227.    Begin VB.Image RibbonTopCustom_over 
  228.       Height          =   390
  229.       Left            =   4680
  230.       Top             =   480
  231.       Visible         =   0   'False
  232.       Width           =   225
  233.    End
  234.    Begin VB.Image RibbonTopCustom 
  235.       Height          =   390
  236.       Left            =   4440
  237.       Top             =   480
  238.       Width           =   225
  239.    End
  240.    Begin VB.Image Button_right 
  241.       Height          =   990
  242.       Index           =   0
  243.       Left            =   4200
  244.       Top             =   2520
  245.       Visible         =   0   'False
  246.       Width           =   45
  247.    End
  248.    Begin VB.Image Button_center 
  249.       Height          =   990
  250.       Index           =   0
  251.       Left            =   3360
  252.       Stretch         =   -1  'True
  253.       Top             =   2520
  254.       Visible         =   0   'False
  255.       Width           =   735
  256.    End
  257.    Begin VB.Image Button_left 
  258.       Height          =   990
  259.       Index           =   0
  260.       Left            =   3240
  261.       Top             =   2520
  262.       Visible         =   0   'False
  263.       Width           =   45
  264.    End
  265.    Begin VB.Label TBMouse 
  266.       BeginProperty Font 
  267.          Name            =   "MS Sans Serif"
  268.          Size            =   8.25
  269.          Charset         =   0
  270.          Weight          =   400
  271.          Underline       =   0   'False
  272.          Italic          =   0   'False
  273.          Strikethrough   =   0   'False
  274.       EndProperty
  275.       Height          =   390
  276.       Index           =   0
  277.       Left            =   4080
  278.       TabIndex        =   8
  279.       Top             =   480
  280.       Visible         =   0   'False
  281.       Width           =   330
  282.    End
  283.    Begin VB.Image RibbonTopImage 
  284.       Height          =   390
  285.       Index           =   0
  286.       Left            =   3360
  287.       Top             =   480
  288.       Width           =   270
  289.    End
  290.    Begin VB.Image RibbonTop_over 
  291.       Height          =   390
  292.       Index           =   0
  293.       Left            =   3720
  294.       Top             =   480
  295.       Visible         =   0   'False
  296.       Width           =   330
  297.    End
  298.    Begin VB.Label TabMouse 
  299.       BeginProperty Font 
  300.          Name            =   "MS Sans Serif"
  301.          Size            =   8.25
  302.          Charset         =   0
  303.          Weight          =   400
  304.          Underline       =   0   'False
  305.          Italic          =   0   'False
  306.          Strikethrough   =   0   'False
  307.       EndProperty
  308.       Height          =   360
  309.       Index           =   0
  310.       Left            =   1800
  311.       TabIndex        =   5
  312.       Top             =   2760
  313.       Visible         =   0   'False
  314.       Width           =   735
  315.    End
  316.    Begin VB.Label Tab_caption 
  317.       AutoSize        =   -1  'True
  318.       BackStyle       =   0  'Transparent
  319.       Caption         =   "Aba 01"
  320.       ForeColor       =   &H00000000&
  321.       Height          =   195
  322.       Index           =   0
  323.       Left            =   120
  324.       TabIndex        =   4
  325.       Top             =   2820
  326.       Visible         =   0   'False
  327.       Width           =   510
  328.    End
  329.    Begin VB.Image Tab_right 
  330.       Height          =   360
  331.       Index           =   0
  332.       Left            =   1560
  333.       Top             =   2760
  334.       Visible         =   0   'False
  335.       Width           =   150
  336.    End
  337.    Begin VB.Image Tab_center 
  338.       Height          =   360
  339.       Index           =   0
  340.       Left            =   1200
  341.       Stretch         =   -1  'True
  342.       Top             =   2760
  343.       Visible         =   0   'False
  344.       Width           =   270
  345.    End
  346.    Begin VB.Image Tab_left 
  347.       Height          =   360
  348.       Index           =   0
  349.       Left            =   960
  350.       Top             =   2760
  351.       Visible         =   0   'False
  352.       Width           =   150
  353.    End
  354.    Begin VB.Image Tab_left_over 
  355.       Height          =   360
  356.       Index           =   0
  357.       Left            =   960
  358.       Top             =   3240
  359.       Visible         =   0   'False
  360.       Width           =   150
  361.    End
  362.    Begin VB.Image Tab_center_over 
  363.       Height          =   360
  364.       Index           =   0
  365.       Left            =   1200
  366.       Stretch         =   -1  'True
  367.       Top             =   3240
  368.       Visible         =   0   'False
  369.       Width           =   270
  370.    End
  371.    Begin VB.Image Tab_right_over 
  372.       Height          =   360
  373.       Index           =   0
  374.       Left            =   1560
  375.       Top             =   3240
  376.       Visible         =   0   'False
  377.       Width           =   150
  378.    End
  379.    Begin VB.Label CatMouse 
  380.       BeginProperty Font 
  381.          Name            =   "MS Sans Serif"
  382.          Size            =   8.25
  383.          Charset         =   0
  384.          Weight          =   400
  385.          Underline       =   0   'False
  386.          Italic          =   0   'False
  387.          Strikethrough   =   0   'False
  388.       EndProperty
  389.       Height          =   1350
  390.       Index           =   0
  391.       Left            =   5280
  392.       TabIndex        =   7
  393.       Top             =   750
  394.       Visible         =   0   'False
  395.       Width           =   375
  396.    End
  397.    Begin VB.Label Cat_Caption 
  398.       AutoSize        =   -1  'True
  399.       BackStyle       =   0  'Transparent
  400.       Caption         =   "Label1"
  401.       ForeColor       =   &H00FFFFFF&
  402.       Height          =   195
  403.       Index           =   0
  404.       Left            =   5760
  405.       TabIndex        =   6
  406.       Tag             =   "sadf"
  407.       Top             =   1800
  408.       Visible         =   0   'False
  409.       Width           =   465
  410.    End
  411.    Begin VB.Image Cat_Right_on 
  412.       Height          =   1335
  413.       Index           =   0
  414.       Left            =   6840
  415.       Top             =   750
  416.       Visible         =   0   'False
  417.       Width           =   75
  418.    End
  419.    Begin VB.Image Cat_Center_on 
  420.       Height          =   1335
  421.       Index           =   0
  422.       Left            =   6600
  423.       Stretch         =   -1  'True
  424.       Top             =   750
  425.       Visible         =   0   'False
  426.       Width           =   60
  427.    End
  428.    Begin VB.Image Cat_Left_on 
  429.       Height          =   1335
  430.       Index           =   0
  431.       Left            =   6480
  432.       Top             =   750
  433.       Visible         =   0   'False
  434.       Width           =   60
  435.    End
  436.    Begin VB.Image Cat_Right_off 
  437.       Height          =   1335
  438.       Index           =   0
  439.       Left            =   6120
  440.       Top             =   750
  441.       Visible         =   0   'False
  442.       Width           =   75
  443.    End
  444.    Begin VB.Image Cat_Left_off 
  445.       Height          =   1335
  446.       Index           =   0
  447.       Left            =   5760
  448.       Top             =   750
  449.       Visible         =   0   'False
  450.       Width           =   60
  451.    End
  452.    Begin VB.Image Cat_Center_off 
  453.       Height          =   1335
  454.       Index           =   0
  455.       Left            =   5880
  456.       Stretch         =   -1  'True
  457.       Top             =   750
  458.       Visible         =   0   'False
  459.       Width           =   75
  460.    End
  461.    Begin VB.Label ButtonRibbon 
  462.       BeginProperty Font 
  463.          Name            =   "MS Sans Serif"
  464.          Size            =   8.25
  465.          Charset         =   0
  466.          Weight          =   400
  467.          Underline       =   0   'False
  468.          Italic          =   0   'False
  469.          Strikethrough   =   0   'False
  470.       EndProperty
  471.       Height          =   675
  472.       Left            =   2760
  473.       TabIndex        =   3
  474.       Top             =   960
  475.       Width           =   690
  476.    End
  477.    Begin VB.Image Endon 
  478.       Height          =   345
  479.       Left            =   6240
  480.       Top             =   0
  481.       Visible         =   0   'False
  482.       Width           =   600
  483.    End
  484.    Begin VB.Image Maxon 
  485.       Height          =   345
  486.       Left            =   5520
  487.       Top             =   0
  488.       Visible         =   0   'False
  489.       Width           =   600
  490.    End
  491.    Begin VB.Image Minon 
  492.       Height          =   345
  493.       Left            =   4800
  494.       Top             =   0
  495.       Visible         =   0   'False
  496.       Width           =   600
  497.    End
  498.    Begin VB.Image Endoff 
  499.       Height          =   345
  500.       Left            =   3960
  501.       Top             =   0
  502.       Width           =   600
  503.    End
  504.    Begin VB.Image Maxoff 
  505.       Height          =   345
  506.       Left            =   3240
  507.       Top             =   0
  508.       Width           =   600
  509.    End
  510.    Begin VB.Image Minoff 
  511.       Height          =   345
  512.       Left            =   2520
  513.       Top             =   0
  514.       Width           =   600
  515.    End
  516.    Begin VB.Label Barra 
  517.       Appearance      =   0  'Flat
  518.       BackColor       =   &H00C0FFFF&
  519.       BeginProperty Font 
  520.          Name            =   "Verdana"
  521.          Size            =   9.75
  522.          Charset         =   0
  523.          Weight          =   400
  524.          Underline       =   0   'False
  525.          Italic          =   0   'False
  526.          Strikethrough   =   0   'False
  527.       EndProperty
  528.       ForeColor       =   &H80000008&
  529.       Height          =   390
  530.       Left            =   1440
  531.       TabIndex        =   2
  532.       Top             =   120
  533.       Width           =   495
  534.    End
  535.    Begin VB.Label Titulo 
  536.       AutoSize        =   -1  'True
  537.       BackStyle       =   0  'Transparent
  538.       Caption         =   "Label1"
  539.       ForeColor       =   &H00FFFFFF&
  540.       Height          =   195
  541.       Left            =   120
  542.       TabIndex        =   0
  543.       Top             =   75
  544.       Width           =   465
  545.    End
  546.    Begin VB.Label Titulo2 
  547.       AutoSize        =   -1  'True
  548.       BackStyle       =   0  'Transparent
  549.       Caption         =   "Label1"
  550.       ForeColor       =   &H00FFD18A&
  551.       Height          =   195
  552.       Left            =   840
  553.       TabIndex        =   1
  554.       Top             =   75
  555.       Visible         =   0   'False
  556.       Width           =   465
  557.    End
  558.    Begin VB.Image RibbonTopRight 
  559.       Height          =   390
  560.       Left            =   3120
  561.       Top             =   480
  562.       Width           =   195
  563.    End
  564.    Begin VB.Image RibbonTop 
  565.       Height          =   390
  566.       Left            =   2760
  567.       Stretch         =   -1  'True
  568.       Top             =   480
  569.       Width           =   270
  570.    End
  571.    Begin VB.Image Logo 
  572.       Height          =   360
  573.       Left            =   2760
  574.       Top             =   1680
  575.       Width           =   360
  576.    End
  577.    Begin VB.Image ButtonRibbonon 
  578.       Height          =   675
  579.       Left            =   1800
  580.       Top             =   1440
  581.       Visible         =   0   'False
  582.       Width           =   735
  583.    End
  584.    Begin VB.Image ButtonRibbonover 
  585.       Height          =   675
  586.       Left            =   1800
  587.       Top             =   960
  588.       Visible         =   0   'False
  589.       Width           =   735
  590.    End
  591.    Begin VB.Image ButtonRibbonoff 
  592.       Height          =   675
  593.       Left            =   1800
  594.       Top             =   480
  595.       Width           =   735
  596.    End
  597.    Begin VB.Image BarraLeft 
  598.       Height          =   2130
  599.       Left            =   0
  600.       Top             =   0
  601.       Width           =   105
  602.    End
  603.    Begin VB.Image BarraRight 
  604.       Height          =   2130
  605.       Left            =   960
  606.       Top             =   0
  607.       Width           =   105
  608.    End
  609.    Begin VB.Image Barra2 
  610.       Height          =   2130
  611.       Left            =   0
  612.       Stretch         =   -1  'True
  613.       Top             =   0
  614.       Width           =   405
  615.    End
  616. End
  617. Attribute VB_Name = "ACPRibbon"
  618. Attribute VB_GlobalNameSpace = False
  619. Attribute VB_Creatable = True
  620. Attribute VB_PredeclaredId = False
  621. Attribute VB_Exposed = False
  622. Attribute VB_Ext_KEY = "PropPageWizardRun" ,"Yes"
  623. Option Explicit
  624. '#######################################
  625. '#                                     #
  626. '#           ACP Ribbon 2007           #
  627. '#                  origianlby                 #
  628. '#      adrianopaladini@gmail.com      #
  629. '#               'enhanced by
  630. '#             Anele Mbanga (anele@safiri.co.za)
  631. '#                                     #
  632. '#                                     #con
  633. '#  Visual from Office 2007 Beta 2 TR  #
  634. '#                                     #
  635. '#   Please Don┤t Remove Author & Enhancer Info!  #
  636. '#                                     #
  637. '#######################################
  638. '------------------------------------------------
  639. ' TO DO:
  640. '
  641. ' A) Update when Resize, resolve flicks
  642. ' B) Optimize Code
  643. ' C) Insert Mini Buttons, Combos and Checkbox on Each Categories
  644. ' D) Option to Show Menu Under the Ribbon and Hide Ribbon
  645. ' E) Make Menu
  646. ' F) Option to user customize the menu
  647. ' G) Group Tabs
  648. ' H) Add Comment to All code
  649. ' I) FINISHED this project!
  650. '
  651. '------------------------------------------------
  652. '------------------------------------------------
  653. ' Bugs:
  654. '
  655. ' Please report to:
  656. '
  657. '         adrianopaladini@gmail.com
  658. '
  659. '------------------------------------------------
  660. ' enhancements done by Anele Mbanga (anelem@rocketmail.com) are the following
  661. ' the enhancement made include the following
  662. ' addition of textbox, combobox, datepicker, progress bar, label on buttons
  663. ' animation of main icon, see timer functions on form 1
  664. ' ability to edit the top button, edit the tab caption and button caption including icons thereof
  665. ' buttons now have menus that can be assigned to them
  666. ' buttons and tabs are no longer limited to 90 buttons, a redimensionable array has been used across the board
  667. ' menus, buttons can be added depending on the permissions per button, the permission string must contain the id of a button separated by ;
  668. ' if you like please vote for me
  669. Private TotalTopButton As Integer
  670. Private TotalButton As Integer
  671. Private TotalTabs As Integer
  672. Private TotalCats As Integer
  673. Private Type TabButton
  674.     TabID As String
  675.     TabCaption As String
  676.     TabVisible As Boolean
  677. End Type
  678. Private TabButtons() As TabButton
  679. Private Type CategoryButton
  680.     CatsID As String
  681.     CatsC As String
  682.     CatsT As String
  683.     CatsD As String
  684.     CatsTool As String
  685. End Type
  686. Private CategoryButtons() As CategoryButton
  687. Private Type TopButton
  688.     TopBID As String
  689.     TopBC As String
  690. End Type
  691. Private TopButtons() As TopButton
  692. 'Private mvarHandle As Long
  693. Private TabSelected As String
  694. Private DefFont As StdFont
  695. Private Type RibbonButton
  696.     TopBuID As String
  697.     TopBuS As String
  698.     TopBuC As String
  699.     TopBuI As Picture
  700.     TopBuT As String
  701.     TopBuG As Boolean
  702.     TopBuX As String
  703.     TopTxt As String
  704.     TopWdt As Long
  705.     TopType As String
  706.     TopFormat As String
  707.     TopMin As Long
  708.     TopMax As Long
  709.     menuName As String
  710. End Type
  711. Private sPermissions As String
  712. Private RibbonButtons() As RibbonButton
  713. 'Private Type RECT
  714. '    Left As Long
  715. ''    Top As Long
  716. ''    Right As Long
  717. '    Bottom As Long
  718. 'End Type
  719. Private MS As Boolean
  720. Private Mx As Integer
  721. Private My As Integer
  722. Private iImgLType As Integer
  723. Private sCaption As String
  724. Private Const m_def_Caption = ""
  725. Private Const m_def_ShowCustomMenu = False
  726. Private m_ShowCustomMenu As Boolean
  727. Private mvarUsePermissions As Boolean
  728. Public Event MainMenuClick()
  729. Public Event MenuClick(ByVal Id As String, ByVal Caption As String)
  730. Public Event TabClick(ByVal Id As String, ByVal Caption As String)
  731. Public Event CatClick(ByVal Id As String, ByVal Caption As String)
  732. Public Event ButtonClick(ByVal Id As String, ByVal Caption As String)
  733. Public Event ComboClick(ByVal ComboName As String, ByVal Text As String)
  734. Public Event DatePickClick(ByVal DatePickName As String, ByVal DatePicked As String)
  735. Public Event CustomClick()
  736. Public Event CloseForm()
  737. Public Event MaxForm()
  738. Public Event MinForm()
  739. Private zImg As Variant
  740. Private TAB_NORMAL As Long
  741. Private TAB_SELECTED As Long
  742. Public Enum ThemeEnum
  743.     Black = 0
  744.     Blue = 1
  745.     Silver = 2
  746. End Enum
  747. Public Enum ImageSizeEnum
  748.     SizeNormal = 0
  749.     Size160 = 1
  750.     Size240 = 2
  751.     Size320 = 3
  752. End Enum
  753. Private m_Theme As ThemeEnum
  754. Private m_ImageSize As Integer
  755. Private mParent As Variant
  756. 'Private Const WM_SETREDRAW = &HB
  757. 'Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
  758. 'Private Declare Function GetClientRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
  759. 'Private Const RDW_INVALIDATE = &H1
  760. 'Private Const RDW_INTERNALPAINT = &H2
  761. 'Private Const RDW_UPDATENOW = &H100
  762. 'Private Const RDW_ALLCHILDREN = &H80
  763. 'Private Declare Function RedrawWindow Lib "user32" (ByVal hwnd As Long, lprcUpdate As RECT, ByVal hrgnUpdate As Long, ByVal fuRedraw As Long) As Long
  764. Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long
  765. Public Sub FreezeWindow(ObjSource As Variant, Optional boolAction As Boolean = True)
  766.     On Error Resume Next
  767.     If boolAction = True Then
  768.         LockWindowUpdate ObjSource.hwnd
  769.     Else
  770.         LockWindowUpdate 0&
  771.     End If
  772.     Err.Clear
  773. End Sub
  774. Private Sub Barra_DblClick()
  775.     On Error Resume Next
  776.     Maxon_Click
  777.     Err.Clear
  778. End Sub
  779. Private Sub Barra_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  780.     On Error Resume Next
  781.     Mx = x
  782.     My = y
  783.     MS = True
  784.     Err.Clear
  785. End Sub
  786. Private Sub Barra_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
  787.     On Error Resume Next
  788.     'Freeze
  789.     Dim i As Integer
  790.     Dim iTot As Integer
  791.     Dim KL As Integer
  792.     Dim KLTot As Integer
  793.     If MS = True Then
  794.         mParent.Move mParent.Left - (Mx - x), mParent.Top - (My - y)
  795.     End If
  796.     iTot = TabMouse.UBound
  797.     For i = 0 To iTot
  798.         Tab_center_over(i).Visible = False
  799.         Tab_left_over(i).Visible = False
  800.         Tab_right_over(i).Visible = False
  801.     Next
  802.     iTot = CatMouse.UBound
  803.     For i = 0 To iTot
  804.         Cat_Center_on(i).Visible = False
  805.         Cat_Left_on(i).Visible = False
  806.         Cat_Right_on(i).Visible = False
  807.         If Cat_Dlg(i).Visible = True Then
  808.             Cat_Dlg_on(i).Visible = False
  809.             Cat_Dlg_over(i).Visible = False
  810.         End If
  811.     Next
  812.     KLTot = ButMouse.UBound
  813.     For KL = 0 To KLTot
  814.         Button_left(KL).Visible = False
  815.         Button_right(KL).Visible = False
  816.         Button_center(KL).Visible = False
  817.     Next
  818.     iTot = TBMouse.UBound
  819.     For i = 0 To iTot
  820.         RibbonTop_over(i).Visible = False
  821.     Next
  822.     RibbonTopCustom_over.Visible = False
  823.     Endon.Visible = False
  824.     Maxon.Visible = False
  825.     Minon.Visible = False
  826.     ButtonRibbonover.Visible = False
  827.     ButtonRibbonon.Visible = False
  828.     'Freeze False
  829.     Err.Clear
  830. End Sub
  831. Private Sub Barra_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
  832.     On Error Resume Next
  833.     MS = False
  834.     Err.Clear
  835. End Sub
  836. Private Sub Barra2_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
  837.     On Error Resume Next
  838.     'Freeze
  839.     Dim i As Integer
  840.     Dim KL As Integer
  841.     Dim iTot As Integer
  842.     Dim KLTot As Integer
  843.     iTot = TabMouse.UBound
  844.     For i = 0 To iTot
  845.         Tab_center_over(i).Visible = False
  846.         Tab_left_over(i).Visible = False
  847.         Tab_right_over(i).Visible = False
  848.     Next
  849.     iTot = CatMouse.UBound
  850.     For i = 0 To iTot
  851.         Cat_Center_on(i).Visible = False
  852.         Cat_Left_on(i).Visible = False
  853.         Cat_Right_on(i).Visible = False
  854.         If Cat_Dlg(i).Visible = True Then
  855.             Cat_Dlg_on(i).Visible = False
  856.             Cat_Dlg_over(i).Visible = False
  857.         End If
  858.     Next
  859.     KLTot = ButMouse.UBound
  860.     For KL = 0 To KLTot
  861.         Button_left(KL).Visible = False
  862.         Button_right(KL).Visible = False
  863.         Button_center(KL).Visible = False
  864.     Next
  865.     iTot = TBMouse.UBound
  866.     For i = 0 To iTot
  867.         RibbonTop_over(i).Visible = False
  868.     Next
  869.     RibbonTopCustom_over.Visible = False
  870.     Endon.Visible = False
  871.     Maxon.Visible = False
  872.     Minon.Visible = False
  873.     ButtonRibbonover.Visible = False
  874.     ButtonRibbonon.Visible = False
  875.     'Freeze False
  876.     Err.Clear
  877. End Sub
  878. Private Sub BarraLeft_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
  879.     On Error Resume Next
  880.     'Freeze
  881.     Dim i As Integer
  882.     Dim KL As Integer
  883.     Dim iTot As Integer
  884.     Dim KLTot As Integer
  885.     iTot = TabMouse.UBound
  886.     For i = 0 To iTot
  887.         Tab_center_over(i).Visible = False
  888.         Tab_left_over(i).Visible = False
  889.         Tab_right_over(i).Visible = False
  890.     Next
  891.     iTot = CatMouse.UBound
  892.     For i = 0 To iTot
  893.         Cat_Center_on(i).Visible = False
  894.         Cat_Left_on(i).Visible = False
  895.         Cat_Right_on(i).Visible = False
  896.         If Cat_Dlg(i).Visible = True Then
  897.             Cat_Dlg_on(i).Visible = False
  898.             Cat_Dlg_over(i).Visible = False
  899.         End If
  900.     Next
  901.     KLTot = ButMouse.UBound
  902.     For KL = 0 To KLTot
  903.         Button_left(KL).Visible = False
  904.         Button_right(KL).Visible = False
  905.         Button_center(KL).Visible = False
  906.     Next
  907.     iTot = TBMouse.UBound
  908.     For i = 0 To iTot
  909.         RibbonTop_over(i).Visible = False
  910.     Next
  911.     RibbonTopCustom_over.Visible = False
  912.     Endon.Visible = False
  913.     Maxon.Visible = False
  914.     Minon.Visible = False
  915.     ButtonRibbonover.Visible = False
  916.     ButtonRibbonon.Visible = False
  917.     'Freeze False
  918.     Err.Clear
  919. End Sub
  920. Private Sub BarraRight_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
  921.     On Error Resume Next
  922.     'Freeze
  923.     Dim i As Integer
  924.     Dim KL As Integer
  925.     Dim iTot As Integer
  926.     Dim KLTot As Integer
  927.     iTot = TabMouse.UBound
  928.     For i = 0 To iTot
  929.         Tab_center_over(i).Visible = False
  930.         Tab_left_over(i).Visible = False
  931.         Tab_right_over(i).Visible = False
  932.     Next
  933.     iTot = CatMouse.UBound
  934.     For i = 0 To iTot
  935.         Cat_Center_on(i).Visible = False
  936.         Cat_Left_on(i).Visible = False
  937.         Cat_Right_on(i).Visible = False
  938.         If Cat_Dlg(i).Visible = True Then
  939.             Cat_Dlg_on(i).Visible = False
  940.             Cat_Dlg_over(i).Visible = False
  941.         End If
  942.     Next
  943.     KLTot = ButMouse.UBound
  944.     For KL = 0 To KLTot
  945.         Button_left(KL).Visible = False
  946.         Button_right(KL).Visible = False
  947.         Button_center(KL).Visible = False
  948.     Next
  949.     iTot = TBMouse.UBound
  950.     For i = 0 To iTot
  951.         RibbonTop_over(i).Visible = False
  952.     Next
  953.     RibbonTopCustom_over.Visible = False
  954.     Endon.Visible = False
  955.     Maxon.Visible = False
  956.     Minon.Visible = False
  957.     ButtonRibbonover.Visible = False
  958.     ButtonRibbonon.Visible = False
  959.     'Freeze False
  960.     Err.Clear
  961. End Sub
  962. Private Sub ButMouse_Click(Index As Integer)
  963.     On Error Resume Next
  964.     Dim butPos As Integer
  965.     Dim strMenu As String
  966.     Dim zID As String
  967.     zID = ButMouse(Index).Tag
  968.     butPos = ButtonSearch(ButMouse(Index).Tag)
  969.     strMenu = RibbonButtons(butPos).menuName
  970.     Select Case Len(strMenu)
  971.     Case 0
  972.         ' raise the normal button click
  973.         RaiseEvent ButtonClick(ButMouse(Index).Tag, Button_Caption(Index).Caption)
  974.     Case Else
  975.         ' a menu has been selected
  976.         Dim theMenu As clsMenu
  977.         Dim subMenu As clsMenu
  978.         Dim subTot As Integer
  979.         Dim subCnt As Integer
  980.         Dim menuCnt As Long
  981.         Dim menuTot As Long
  982.         Dim strLine As String
  983.         Dim menuParent As String
  984.         Dim menuID As String
  985.         Dim menuCaption As String
  986.         Dim menuSelect As String
  987.         Dim lngChildren As Long
  988.         Dim spChildren() As String
  989.         Dim curChild As String
  990.         Dim cntChildren As Integer
  991.         Dim totChildren As Integer
  992.         Dim spTot As Long
  993.         Dim spCnt As Long
  994.         Dim subMenuID As String
  995.         Dim psubMenuID As String
  996.         Dim hasSubMenus As String
  997.         Dim strSimilar As String
  998.         ' this is used to group the menus and extract those relevant to this menu
  999.         cboMenus1.Clear
  1000.         menuTot = cboMenus.ListCount - 1
  1001.         For menuCnt = 0 To menuTot
  1002.             strLine = cboMenus.List(menuCnt)
  1003.             menuParent = MvField(strLine, 1, "|")
  1004.             menuID = MvField(strLine, 2, "|")
  1005.             menuID = RemDelim(menuID, "\")
  1006.             menuCaption = MvField(strLine, 3, "|")
  1007.             hasSubMenus = MvField(strLine, 4, "|")
  1008.             If LCase$(menuParent) = LCase$(zID) Then
  1009.                 strSimilar = MenuSimilar(menuID)
  1010.                 spTot = StrParse(spChildren, strSimilar, ";")
  1011.                 For spCnt = 1 To spTot
  1012.                     cboMenus1.AddItem spChildren(spCnt)
  1013.                 Next
  1014.             End If
  1015.         Next
  1016.         Set theMenu = New clsMenu
  1017.         theMenu.Reset
  1018.         menuTot = cboMenus1.ListCount - 1
  1019.         For menuCnt = 0 To menuTot
  1020.             strLine = cboMenus1.List(menuCnt)
  1021.             menuParent = MvField(strLine, 1, "|")
  1022.             menuID = MvField(strLine, 2, "|")
  1023.             menuID = RemDelim(menuID, "\")
  1024.             menuCaption = MvField(strLine, 3, "|")
  1025.             hasSubMenus = MvField(strLine, 4, "|")
  1026.             If LCase$(menuParent) <> LCase$(zID) Then GoTo NextMenu
  1027.             ' does this have submenus
  1028.             If InStr(1, menuID, "\") = 0 Then
  1029.                 If hasSubMenus = "1" Then
  1030.                     Set subMenu = New clsMenu
  1031.                     subMenu.Caption = menuCaption
  1032.                     theMenu.AddMenu menuID, subMenu
  1033.                 Else
  1034.                     theMenu.AddMenu menuID, menuCaption
  1035.                 End If
  1036.             Else
  1037.                 ' the menu has children
  1038.                 spTot = StrParse(spChildren, menuID, "\")
  1039.                 For spCnt = 2 To spTot
  1040.                     subMenuID = MvFromMv(menuID, spCnt, 1, "\")
  1041.                     subMenu.AddMenu subMenuID, menuCaption
  1042.                 Next
  1043.             End If
  1044. NextMenu:
  1045.         Next
  1046.         If theMenu.MenuCount >= 1 Then
  1047.             menuSelect = theMenu.TrackMenu
  1048.             RaiseEvent ButtonClick(menuSelect, "")
  1049.         End If
  1050.     End Select
  1051.     Err.Clear
  1052. End Sub
  1053. Private Sub ButMouse_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
  1054.     On Error Resume Next
  1055.     Button_left_over(Index).Visible = True
  1056.     Button_center_over(Index).Visible = True
  1057.     Button_right_over(Index).Visible = True
  1058.     Err.Clear
  1059. End Sub
  1060. Private Sub ButMouse_MouseUp(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
  1061.     On Error Resume Next
  1062.     Button_left_over(Index).Visible = False
  1063.     Button_center_over(Index).Visible = False
  1064.     Button_right_over(Index).Visible = False
  1065.     Err.Clear
  1066. End Sub
  1067. Private Sub ButtonRibbon_Click()
  1068.     On Error Resume Next
  1069.     RaiseEvent MainMenuClick
  1070.     Err.Clear
  1071. End Sub
  1072. Private Sub ButtonRibbon_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  1073.     On Error Resume Next
  1074.     ButtonRibbonover.Visible = False
  1075.     ButtonRibbonon.Visible = True
  1076.     Err.Clear
  1077. End Sub
  1078. Private Sub ButtonRibbon_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
  1079.     On Error Resume Next
  1080.     ButtonRibbonover.Visible = True
  1081.     ButtonRibbonon.Visible = False
  1082.     Err.Clear
  1083. End Sub
  1084. Private Sub Cat_Dlg_over_Click(Index As Integer)
  1085.     On Error Resume Next
  1086.     RaiseEvent CatClick(Cat_Caption(Index).Tag, Cat_Caption(Index).Caption)
  1087.     Err.Clear
  1088. End Sub
  1089. Private Sub cboBox_Click(Index As Integer)
  1090.     On Error Resume Next
  1091.     RaiseEvent ComboClick(cboBox(Index).Tag, cboBox(Index).Text)
  1092.     Err.Clear
  1093. End Sub
  1094. Private Sub datePick_CloseUp(Index As Integer)
  1095.     On Error Resume Next
  1096.     RaiseEvent DatePickClick(datePick(Index).Tag, Format$(datePick(Index).Value, datePick(Index).CustomFormat))
  1097.     Err.Clear
  1098. End Sub
  1099. Private Sub Endon_Click()
  1100.     On Error Resume Next
  1101.     Endon.Visible = False
  1102.     RaiseEvent CloseForm
  1103.     Unload mParent
  1104.     Err.Clear
  1105. End Sub
  1106. Private Sub Maxon_Click()
  1107.     On Error Resume Next
  1108.     Maxon.Visible = False
  1109.     RaiseEvent MaxForm
  1110.     Err.Clear
  1111. End Sub
  1112. Private Sub Minon_Click()
  1113.     On Error Resume Next
  1114.     Minon.Visible = False
  1115.     RaiseEvent MinForm
  1116.     Err.Clear
  1117. End Sub
  1118. Private Sub TBMouse_Click(Index As Integer)
  1119.     On Error Resume Next
  1120.     RaiseEvent MenuClick(TopButtons(Index).TopBID, TopButtons(Index).TopBC)
  1121.     Err.Clear
  1122. End Sub
  1123. 'Public Sub SetRibbon()
  1124. '
  1125. '    UserControl_Initialize
  1126. '
  1127. 'End Sub
  1128. Private Sub UserControl_Initialize()
  1129.     On Error Resume Next
  1130.     Theme = Blue
  1131.     ImageList = Nothing
  1132.     TotalTopButton = 0
  1133.     TotalButton = 0
  1134.     TotalTabs = 0
  1135.     TotalCats = 0
  1136.     Caption = "Ribbon Control"
  1137.     TabSelected = ""
  1138.     ImageSize = SizeNormal
  1139.     Barra.BackStyle = 0
  1140.     ButtonRibbon.BackStyle = 0
  1141.     TabMouse(0).BackStyle = 0
  1142.     CatMouse(0).BackStyle = 0
  1143.     TBMouse(0).BackStyle = 0
  1144.     ButMouse(0).BackStyle = 0
  1145.     Err.Clear
  1146. End Sub
  1147. Public Property Get ImageSize() As ImageSizeEnum
  1148.     On Error Resume Next
  1149.     ImageSize = m_ImageSize
  1150.     Err.Clear
  1151. End Property
  1152. Public Property Let ImageSize(ByVal New_Size As ImageSizeEnum)
  1153.     On Error Resume Next
  1154.     m_ImageSize = New_Size
  1155.     PropertyChanged "ImageSize"
  1156.     Err.Clear
  1157. End Property
  1158. 'Public Property Get Handle() As Long
  1159. '
  1160. '    Handle = mvarHandle
  1161. '
  1162. 'End Property
  1163. 'Public Property Let Handle(ByVal New_Handle As Long)
  1164. '
  1165. '    mvarHandle = New_Handle
  1166. '    PropertyChanged "Handle"
  1167. '
  1168. 'End Property
  1169. Public Property Get UsePermissions() As Boolean
  1170.     On Error Resume Next
  1171.     UsePermissions = mvarUsePermissions
  1172.     Err.Clear
  1173. End Property
  1174. Public Property Let UsePermissions(ByVal New_Handle As Boolean)
  1175.     On Error Resume Next
  1176.     mvarUsePermissions = New_Handle
  1177.     PropertyChanged "UsePermissions"
  1178.     Err.Clear
  1179. End Property
  1180. Public Property Get Caption() As String
  1181.     On Error Resume Next
  1182.     Caption = sCaption
  1183.     Err.Clear
  1184. End Property
  1185. Public Property Let Caption(ByVal New_Caption As String)
  1186.     On Error Resume Next
  1187.     Dim InicioArea As Long
  1188.     Dim area As Long
  1189.     FreezeWindow Me
  1190.     sCaption = New_Caption
  1191.     PropertyChanged "Caption"
  1192.     If m_ShowCustomMenu = True Then
  1193.         InicioArea = (RibbonTopCustom.Left + RibbonTopCustom.Width)
  1194.     Else
  1195.         InicioArea = (RibbonTopRight.Left + RibbonTopRight.Width)
  1196.     End If
  1197.     area = UserControl.Width - (InicioArea + (Endoff.Width * 3))
  1198.     'pos = InStr(sCaption, " - ")
  1199.     'If pos > 0 Then
  1200.     '    Titulo.Caption = Mid$(sCaption, 1, pos + 2)
  1201.     '    Titulo2.Caption = Mid$(sCaption, pos + 3)
  1202.     '    Titulo.Left = ((area - (Titulo.Width + Titulo2.Width)) / 2) + InicioArea
  1203.     '    Titulo2.Left = Titulo.Left + Titulo.Width
  1204.     '    Titulo2.Visible = True
  1205.     'Else
  1206.     Titulo.Caption = sCaption
  1207.     Titulo.Left = ((area - Titulo.Width) / 2) + InicioArea
  1208.     Titulo2.Visible = False
  1209.     'End If
  1210.     FreezeWindow Me, False
  1211.     Err.Clear
  1212. End Property
  1213. Public Property Get Permissions() As String
  1214.     On Error Resume Next
  1215.     Permissions = sPermissions
  1216.     Err.Clear
  1217. End Property
  1218. Public Property Let Permissions(ByVal vData As String)
  1219.     On Error Resume Next
  1220.     sPermissions = vData
  1221.     PropertyChanged "Permissions"
  1222.     Err.Clear
  1223. End Property
  1224. Public Sub Refresh()
  1225.     On Error Resume Next
  1226.     FreezeWindow Me
  1227.     TabsUpdate
  1228.     CatsUpdate
  1229.     FreezeWindow Me, False
  1230.     Err.Clear
  1231. End Sub
  1232. Private Sub UserControl_InitProperties()
  1233.     On Error Resume Next
  1234.     sCaption = m_def_Caption
  1235.     m_ShowCustomMenu = m_def_ShowCustomMenu
  1236.     Theme = 1
  1237.     Err.Clear
  1238. End Sub
  1239. Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
  1240.     On Error Resume Next
  1241.     'Freeze
  1242.     Set DefFont = New StdFont
  1243.     DefFont.Name = "Tahoma"
  1244.     DefFont.Size = 8
  1245.     ImageSize = PropBag.ReadProperty("ImageSize", m_ImageSize)
  1246.     Set Font = PropBag.ReadProperty("Font", DefFont)
  1247.     Caption = PropBag.ReadProperty("Caption", m_def_Caption)
  1248.     Set Picture = PropBag.ReadProperty("Picture", Nothing)
  1249.     ShowCustomMenu = PropBag.ReadProperty("ShowCustomMenu", m_def_ShowCustomMenu)
  1250.     Theme = PropBag.ReadProperty("Theme", 1)
  1251.     UsePermissions = PropBag.ReadProperty("UsePermissions", True)
  1252.     'Freeze False
  1253.     Err.Clear
  1254. End Sub
  1255. Private Sub UserControl_Show()
  1256.     On Error Resume Next
  1257.     Resize
  1258.     Err.Clear
  1259. End Sub
  1260. Private Sub UserControl_Terminate()
  1261.     On Error Resume Next
  1262.     Me.Clear
  1263.     Err.Clear
  1264. End Sub
  1265. Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
  1266.     On Error Resume Next
  1267.     Set DefFont = New StdFont
  1268.     DefFont.Name = "Tahoma"
  1269.     DefFont.Size = 8
  1270.     Call PropBag.WriteProperty("ImageSize", m_ImageSize)
  1271.     Call PropBag.WriteProperty("Font", Font, DefFont)
  1272.     Call PropBag.WriteProperty("Caption", sCaption, m_def_Caption)
  1273.     Call PropBag.WriteProperty("Picture", Picture, Nothing)
  1274.     Call PropBag.WriteProperty("ShowCustomMenu", m_ShowCustomMenu, m_def_ShowCustomMenu)
  1275.     Call PropBag.WriteProperty("Theme", m_Theme, 1)
  1276.     Call PropBag.WriteProperty("UsePermissions", mvarUsePermissions, True)
  1277.     Err.Clear
  1278. End Sub
  1279. Public Function AddTab(zID As String, zCaption As String, zVisible As Boolean) As Long
  1280.     On Error Resume Next
  1281.     If UsePermissions = False Then GoTo AddIt
  1282.     Dim strPrefix As String
  1283.     Dim strSuffix As String
  1284.     strPrefix = MvField(zID, 1, "_")
  1285.     Select Case strPrefix
  1286.     Case "openportfolio"
  1287.         strSuffix = MvField(zID, -1, "-")
  1288.         If IsNumeric(strSuffix) = True Then
  1289.         Else
  1290.             strSuffix = MvField(zID, 3, "_")
  1291.             If MvSearch(Permissions, "openportfolio_" & strSuffix, ";") = 0 Then Exit Function
  1292.         End If
  1293.     Case Else
  1294.         If MvSearch(Permissions, zID, ";") = 0 Then Exit Function
  1295.     End Select
  1296. AddIt:
  1297.     zCaption = ProperCase(Replace$(zCaption, "&", "&&"))
  1298.     TotalTabs = TotalTabs + 1
  1299.     ReDim Preserve TabButtons(TotalTabs - 1)
  1300.     TabButtons(TotalTabs - 1).TabID = zID
  1301.     zCaption = Replace$(zCaption, vbNewLine, " ")
  1302.     TabButtons(TotalTabs - 1).TabCaption = zCaption
  1303.     TabButtons(TotalTabs - 1).TabVisible = zVisible
  1304.     If Len(TabSelected) = 0 Then
  1305.         TabSelected = zID
  1306.     End If
  1307.     AddTab = TotalTabs - 1
  1308.     TabsUpdate
  1309.     Err.Clear
  1310. End Function
  1311. Public Sub EditTab(tabPos As Integer, ByVal zCaption As String)
  1312.     On Error Resume Next
  1313.     zCaption = ProperCase(Replace$(zCaption, "&", "&&"))
  1314.     zCaption = Replace$(zCaption, vbNewLine, " ")
  1315.     TabButtons(tabPos).TabCaption = zCaption
  1316.     TabsUpdate
  1317.     Err.Clear
  1318. End Sub
  1319. Public Sub RenameTab(ByVal zTab As String, ByVal zCaption As String)
  1320.     On Error Resume Next
  1321.     Dim tabPos As Integer
  1322.     tabPos = TabSearch(zTab)
  1323.     If tabPos >= 0 Then EditTab tabPos, zCaption
  1324.     Err.Clear
  1325. End Sub
  1326. Public Sub AddCat(zID As String, zTab As String, zCaption As String, zDlgButton As Boolean, ByVal zToolTip As String)
  1327.     On Error Resume Next
  1328.     If UsePermissions = False Then GoTo AddIt
  1329.     Dim strPrefix As String
  1330.     Dim strSuffix As String
  1331.     strPrefix = MvField(zID, 1, "_")
  1332.     Select Case strPrefix
  1333.     Case "openportfolio"
  1334.         strSuffix = MvField(zID, -1, "-")
  1335.         If IsNumeric(strSuffix) = True Then
  1336.         Else
  1337.             strSuffix = MvField(zID, 3, "_")
  1338.             If MvSearch(Permissions, "openportfolio_" & strSuffix, ";") = 0 Then Exit Sub
  1339.         End If
  1340.     Case Else
  1341.         If MvSearch(Permissions, zID, ";") = 0 Then Exit Sub
  1342.     End Select
  1343. AddIt:
  1344.     zCaption = ProperCase(Replace$(zCaption, "&", "&&"))
  1345.     TotalCats = TotalCats + 1
  1346.     ReDim Preserve CategoryButtons(TotalCats - 1)
  1347.     CategoryButtons(TotalCats - 1).CatsID = zID
  1348.     CategoryButtons(TotalCats - 1).CatsT = zTab
  1349.     zCaption = Replace$(zCaption, vbNewLine, " ")
  1350.     CategoryButtons(TotalCats - 1).CatsC = zCaption
  1351.     CategoryButtons(TotalCats - 1).CatsD = zDlgButton
  1352.     CategoryButtons(TotalCats - 1).CatsTool = zToolTip
  1353.     CatsUpdate
  1354.     Err.Clear
  1355. End Sub
  1356. Public Sub AddTopButton(zID As String, zCaption As String, zPicture As Variant, zToolTip As String)
  1357.     On Error Resume Next
  1358.     If UsePermissions = False Then GoTo AddIt
  1359.     Dim strPrefix As String
  1360.     Dim strSuffix As String
  1361.     strPrefix = MvField(zID, 1, "_")
  1362.     Select Case strPrefix
  1363.     Case "openportfolio"
  1364.         strSuffix = MvField(zID, -1, "-")
  1365.         If IsNumeric(strSuffix) = True Then
  1366.         Else
  1367.             strSuffix = MvField(zID, 3, "_")
  1368.             If MvSearch(Permissions, "openportfolio_" & strSuffix, ";") = 0 Then Exit Sub
  1369.         End If
  1370.     Case Else
  1371.         If MvSearch(Permissions, zID, ";") = 0 Then Exit Sub
  1372.     End Select
  1373. AddIt:
  1374.     TotalTopButton = TotalTopButton + 1
  1375.     ReDim Preserve TopButtons(TotalTopButton - 1)
  1376.     TopButtons(TotalTopButton - 1).TopBID = zID
  1377.     TopButtons(TotalTopButton - 1).TopBC = zCaption
  1378.     If TotalTopButton <> 1 Then
  1379.         Load RibbonTopImage(TotalTopButton - 1)
  1380.         Load RibbonTop_over(TotalTopButton - 1)
  1381.         Load TBMouse(TotalTopButton - 1)
  1382.     End If
  1383.     TBMouse(TotalTopButton - 1).Top = 0
  1384.     RibbonTop_over(TotalTopButton - 1).Top = 0
  1385.     RibbonTop_over(TotalTopButton - 1).Left = RibbonTop.Left + (330 * (TotalTopButton - 1))
  1386.     TBMouse(TotalTopButton - 1).Left = RibbonTop_over(TotalTopButton - 1).Left
  1387.     Set RibbonTopImage(TotalTopButton - 1).Picture = zImg.ListImages.Item(GetIconIndex(zImg, zPicture)).Picture
  1388.     RibbonTopImage(TotalTopButton - 1).Top = (RibbonTop.Height - RibbonTopImage(TotalTopButton - 1).Height) / 2
  1389.     'ct = (RibbonTop_over(TotalTopButton - 1).Width - RibbonTopImage(TotalTopButton - 1).Width) / 2
  1390.     ' for some reasons, the picture for the first top button
  1391.     ' is not always correct, this is a fix
  1392.     If TotalTopButton - 1 = 0 Then
  1393.         RibbonTopImage(TotalTopButton - 1).Height = RibbonTop_over(TotalTopButton - 1).Height - 60
  1394.     Else
  1395.         RibbonTopImage(TotalTopButton - 1).Height = RibbonTop_over(TotalTopButton - 1).Height - 120
  1396.     End If
  1397.     RibbonTopImage(TotalTopButton - 1).Left = RibbonTop_over(TotalTopButton - 1).Left + 30
  1398.     RibbonTopImage(TotalTopButton - 1).Width = RibbonTop_over(TotalTopButton - 1).Width - 60
  1399.     RibbonTopImage(TotalTopButton - 1).Top = RibbonTop_over(TotalTopButton - 1).Top + 60
  1400.     RibbonTop_over(TotalTopButton - 1).Visible = False
  1401.     RibbonTop_over(TotalTopButton - 1).ZOrder 0
  1402.     RibbonTopImage(TotalTopButton - 1).Visible = True
  1403.     RibbonTopImage(TotalTopButton - 1).ZOrder 0
  1404.     RibbonTopImage(TotalTopButton - 1).Stretch = True
  1405.     If Len(zToolTip) = 0 Or zToolTip = Null Then
  1406.         If InStr(zCaption, vbNewLine) Then
  1407.             zCaption = Replace$(zCaption, vbNewLine, " ")
  1408.         End If
  1409.         TBMouse(TotalTopButton - 1).ToolTipText = zCaption
  1410.     Else
  1411.         zToolTip = Replace$(zToolTip, vbNewLine, " ")
  1412.         TBMouse(TotalTopButton - 1).ToolTipText = zToolTip
  1413.     End If
  1414.     TBMouse(TotalTopButton - 1).Visible = True
  1415.     TBMouse(TotalTopButton - 1).ZOrder 0
  1416.     CatsUpdate
  1417.     Err.Clear
  1418. End Sub
  1419. Public Sub ResizeLogo(lngSize As Long)
  1420.     On Error Resume Next
  1421.     Logo.Stretch = True
  1422.     Logo.Height = lngSize
  1423.     Logo.Width = lngSize
  1424.     Logo.Refresh
  1425.     Err.Clear
  1426. End Sub
  1427. Public Property Get ShowCustomMenu() As Boolean
  1428.     On Error Resume Next
  1429.     ShowCustomMenu = m_ShowCustomMenu
  1430.     Err.Clear
  1431. End Property
  1432. Public Property Let ShowCustomMenu(ByVal New_ShowCustomMenu As Boolean)
  1433.     On Error Resume Next
  1434.     m_ShowCustomMenu = New_ShowCustomMenu
  1435.     PropertyChanged "ShowCustomMenu"
  1436.     Err.Clear
  1437. End Property
  1438. Private Sub RibbonTopCustom_over_Click()
  1439.     On Error Resume Next
  1440.     RaiseEvent CustomClick
  1441.     Err.Clear
  1442. End Sub
  1443. Public Sub AddButton(zID As String, zSubCat As String, zCaption As String, zPicture As Variant, zMore As Boolean, zToolTip As String, SplitCaption As Boolean)
  1444.     On Error Resume Next
  1445.     If UsePermissions = False Then GoTo AddIt
  1446.     Dim strPrefix As String
  1447.     Dim strSuffix As String
  1448.     strPrefix = MvField(zID, 1, "_")
  1449.     Select Case strPrefix
  1450.     Case "openportfolio"
  1451.         strSuffix = MvField(zID, -1, "-")
  1452.         If IsNumeric(strSuffix) = True Then
  1453.         Else
  1454.             strSuffix = MvField(zID, 3, "_")
  1455.             If MvSearch(Permissions, "openportfolio_" & strSuffix, ";") = 0 Then Exit Sub
  1456.         End If
  1457.     Case Else
  1458.         If MvSearch(Permissions, zID, ";") = 0 Then Exit Sub
  1459.     End Select
  1460. AddIt:
  1461.     zCaption = ProperCase(zCaption)
  1462.     If SplitCaption = True Then zCaption = Replace$(zCaption, " ", vbNewLine)
  1463.     TotalButton = TotalButton + 1
  1464.     ReDim Preserve RibbonButtons(TotalButton - 1)
  1465.     RibbonButtons(TotalButton - 1).TopBuID = zID
  1466.     RibbonButtons(TotalButton - 1).TopBuS = zSubCat
  1467.     RibbonButtons(TotalButton - 1).TopBuC = zCaption
  1468.     If Len(zToolTip) = 0 Or zToolTip = Null Then
  1469.         If InStr(zCaption, vbNewLine) Then
  1470.             zCaption = Replace$(zCaption, vbNewLine, " ")
  1471.         End If
  1472.         RibbonButtons(TotalButton - 1).TopBuT = zCaption
  1473.     Else
  1474.         zToolTip = Replace$(zToolTip, vbNewLine, " ")
  1475.         RibbonButtons(TotalButton - 1).TopBuT = zToolTip
  1476.     End If
  1477.     Set RibbonButtons(TotalButton - 1).TopBuI = Nothing
  1478.     If Len(zPicture) > 0 Then Set RibbonButtons(TotalButton - 1).TopBuI = zImg.ListImages.Item(GetIconIndex(zImg, zPicture)).Picture
  1479.     RibbonButtons(TotalButton - 1).TopBuG = zMore
  1480.     RibbonButtons(TotalButton - 1).TopTxt = ""
  1481.     RibbonButtons(TotalButton - 1).TopWdt = 0
  1482.     RibbonButtons(TotalButton - 1).TopType = ""
  1483.     RibbonButtons(TotalButton - 1).TopFormat = ""
  1484.     RibbonButtons(TotalButton - 1).TopBuX = ""
  1485.     CatsUpdate
  1486.     Err.Clear
  1487. End Sub
  1488. Public Sub AddComboBox(zID As String, zSubCat As String, zCaption As String, zToolTip As String, ByVal cboName As String, ByVal cboWidth As Long)
  1489.     On Error Resume Next
  1490.     If UsePermissions = False Then GoTo AddIt
  1491.     Dim strPrefix As String
  1492.     Dim strSuffix As String
  1493.     strPrefix = MvField(zID, 1, "_")
  1494.     Select Case strPrefix
  1495.     Case "openportfolio"
  1496.         strSuffix = MvField(zID, -1, "-")
  1497.         If IsNumeric(strSuffix) = True Then
  1498.         Else
  1499.             strSuffix = MvField(zID, 3, "_")
  1500.             If MvSearch(Permissions, "openportfolio_" & strSuffix, ";") = 0 Then Exit Sub
  1501.         End If
  1502.     Case Else
  1503.         If MvSearch(Permissions, zID, ";") = 0 Then Exit Sub
  1504.     End Select
  1505. AddIt:
  1506.     zCaption = ProperCase(zCaption)
  1507.     TotalButton = TotalButton + 1
  1508.     ReDim Preserve RibbonButtons(TotalButton - 1)
  1509.     RibbonButtons(TotalButton - 1).TopBuID = zID
  1510.     RibbonButtons(TotalButton - 1).TopBuS = zSubCat
  1511.     RibbonButtons(TotalButton - 1).TopBuC = zCaption
  1512.     If Len(zToolTip) = 0 Or zToolTip = Null Then
  1513.         If InStr(zCaption, vbNewLine) Then
  1514.             zCaption = Replace$(zCaption, vbNewLine, " ")
  1515.         End If
  1516.         RibbonButtons(TotalButton - 1).TopBuT = zCaption
  1517.     Else
  1518.         zToolTip = Replace$(zToolTip, vbNewLine, " ")
  1519.         RibbonButtons(TotalButton - 1).TopBuT = zToolTip
  1520.     End If
  1521.     Set RibbonButtons(TotalButton - 1).TopBuI = Nothing
  1522.     RibbonButtons(TotalButton - 1).TopBuG = False
  1523.     RibbonButtons(TotalButton - 1).TopTxt = cboName
  1524.     RibbonButtons(TotalButton - 1).TopWdt = cboWidth
  1525.     RibbonButtons(TotalButton - 1).TopType = "c"
  1526.     RibbonButtons(TotalButton - 1).TopFormat = ""
  1527.     CatsUpdate
  1528.     Err.Clear
  1529. End Sub
  1530. Public Sub TabShow(ByVal zID As String)
  1531.     On Error Resume Next
  1532.     Dim myLocation As Integer
  1533.     myLocation = TabSearch(zID)
  1534.     If myLocation <> -1 Then
  1535.         SaveSetting App.Title, "click", "tab", zID
  1536.         TabButtons(myLocation).TabVisible = True
  1537.         Me.Refresh
  1538.         TabMouse_Click myLocation
  1539.     End If
  1540.     Err.Clear
  1541. End Sub
  1542. Public Sub TabHide(ByVal zID As String)
  1543.     On Error Resume Next
  1544.     Dim myLocation As Integer
  1545.     myLocation = TabSearch(zID)
  1546.     If myLocation <> -1 Then
  1547.         TabButtons(myLocation).TabVisible = False
  1548.         Me.Refresh
  1549.         TabMouse_Click 0
  1550.     End If
  1551.     Err.Clear
  1552. End Sub
  1553. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
  1554. 'MemberInfo=14,0,0,0
  1555. 'Public Property Get Theme() As ThemeEnum
  1556. '
  1557. '    Theme = m_Theme
  1558. '
  1559. 'End Property
  1560. Public Property Let Theme(ByVal New_Theme As ThemeEnum)
  1561.     On Error Resume Next
  1562.     'Freeze
  1563.     m_Theme = New_Theme
  1564.     PropertyChanged "Theme"
  1565.     LoadTheme m_Theme
  1566.     'Freeze False
  1567.     Err.Clear
  1568. End Property
  1569. Public Sub LoadTheme(iTema As ThemeEnum)
  1570.     On Error Resume Next
  1571.     Dim Id As String
  1572.     Select Case iTema
  1573.     Case 0
  1574.         Id = "BLACK"
  1575.         Titulo.ForeColor = &HFFFFFF
  1576.         Titulo2.ForeColor = &HFFD18A
  1577.         Cat_Caption(0).ForeColor = &HFFFFFF
  1578.         TAB_NORMAL = vbWhite
  1579.         TAB_SELECTED = vbBlack
  1580.         Button_Caption(0).ForeColor = &H80000008
  1581.     Case 1
  1582.         Id = "BLUE"
  1583.         Titulo.ForeColor = &H797069
  1584.         Titulo2.ForeColor = &HB86A3E
  1585.         Cat_Caption(0).ForeColor = &HB86A3E
  1586.         TAB_NORMAL = &H8B4215
  1587.         TAB_SELECTED = &H8B4215
  1588.         Button_Caption(0).ForeColor = &H8B4215
  1589.     Case 2
  1590.         Id = "SILVER"
  1591.         Titulo.ForeColor = &H6A625C
  1592.         Titulo2.ForeColor = &HB86A3E
  1593.         Cat_Caption(0).ForeColor = &H6A625C
  1594.         TAB_NORMAL = &H6A625C
  1595.         TAB_SELECTED = &H6A625C
  1596.         Button_Caption(0).ForeColor = &H6A625C
  1597.     Case Else
  1598.         Id = "BLACK"
  1599.     End Select
  1600.     Set Barra2.Picture = LoadResourcePicture(101, Id)
  1601.     Set BarraLeft.Picture = LoadResourcePicture(102, Id)
  1602.     Set BarraRight.Picture = LoadResourcePicture(103, Id)
  1603.     Set Minoff.Picture = LoadResourcePicture(104, Id)
  1604.     Set Minon.Picture = LoadResourcePicture(105, Id)
  1605.     Set Maxoff.Picture = LoadResourcePicture(106, Id)
  1606.     Set Maxon.Picture = LoadResourcePicture(107, Id)
  1607.     Set Endoff.Picture = LoadResourcePicture(108, Id)
  1608.     Set Endon.Picture = LoadResourcePicture(109, Id)
  1609.     Set ButtonRibbonoff.Picture = LoadResourcePicture(110, Id)
  1610.     Set ButtonRibbonover.Picture = LoadResourcePicture(111, Id)
  1611.     Set ButtonRibbonon.Picture = LoadResourcePicture(112, Id)
  1612.     Set RibbonTop.Picture = LoadResourcePicture(113, Id)
  1613.     Set RibbonTopRight.Picture = LoadResourcePicture(114, Id)
  1614.     Set RibbonTopCustom.Picture = LoadResourcePicture(115, Id)
  1615.     Set RibbonTopCustom_over.Picture = LoadResourcePicture(116, Id)
  1616.     Set RibbonTop_over(0).Picture = LoadResourcePicture(117, Id)
  1617.     Set Cat_Dlg(0).Picture = LoadResourcePicture(118, Id)
  1618.     Set Cat_Dlg_on(0).Picture = LoadResourcePicture(119, Id)
  1619.     Set Cat_Dlg_over(0).Picture = LoadResourcePicture(120, Id)
  1620.     Set Cat_Left_off(0).Picture = LoadResourcePicture(121, Id)
  1621.     Set Cat_Center_off(0).Picture = LoadResourcePicture(122, Id)
  1622.     Set Cat_Right_off(0).Picture = LoadResourcePicture(123, Id)
  1623.     Set Cat_Left_on(0).Picture = LoadResourcePicture(124, Id)
  1624.     Set Cat_Center_on(0).Picture = LoadResourcePicture(125, Id)
  1625.     Set Cat_Right_on(0).Picture = LoadResourcePicture(126, Id)
  1626.     Set Tab_left(0).Picture = LoadResourcePicture(127, Id)
  1627.     Set Tab_center(0).Picture = LoadResourcePicture(128, Id)
  1628.     Set Tab_right(0).Picture = LoadResourcePicture(129, Id)
  1629.     Set Tab_left_over(0).Picture = LoadResourcePicture(130, Id)
  1630.     Set Tab_center_over(0).Picture = LoadResourcePicture(131, Id)
  1631.     Set Tab_right_over(0).Picture = LoadResourcePicture(132, Id)
  1632.     Set Glip_off(0).Picture = LoadResourcePicture(133, Id)
  1633.     Set Glip_on(0).Picture = LoadResourcePicture(134, Id)
  1634.     Set Button_left_over(0).Picture = LoadResourcePicture(135, Id)
  1635.     Set Button_center_over(0).Picture = LoadResourcePicture(136, Id)
  1636.     Set Button_right_over(0).Picture = LoadResourcePicture(137, Id)
  1637.     Set Button_left(0).Picture = LoadResourcePicture(138, Id)
  1638.     Set Button_center(0).Picture = LoadResourcePicture(139, Id)
  1639.     Set Button_right(0).Picture = LoadResourcePicture(140, Id)
  1640.     Err.Clear
  1641. End Sub
  1642. Private Function TempFileName(ByVal strPrefix As String) As String
  1643.     On Error Resume Next
  1644.     Dim fs As FileSystemObject
  1645.     Set fs = New FileSystemObject
  1646.     Dim strTempFolder As String
  1647.     strTempFolder = fs.GetSpecialFolder(Scripting.TemporaryFolder)
  1648.     TempFileName = strTempFolder & "\" & strPrefix & fs.GetTempName()
  1649.     Set fs = Nothing
  1650.     Err.Clear
  1651. End Function
  1652. Public Function LoadResourcePicture(ByVal Id As Variant, ByVal Format As Variant) As IPicture
  1653.     On Error Resume Next
  1654.     Dim sFile As String
  1655.     Dim b() As Byte
  1656.     Dim iFile As Integer
  1657.     On Error GoTo ErrorHandler
  1658.     b = LoadResData(Id, Format)
  1659.     sFile = TempFileName("LRP")
  1660.     iFile = FreeFile
  1661.     Open sFile For Binary Access Write Lock Read As #iFile
  1662.     Put #iFile, , b
  1663.     Close #iFile
  1664.     iFile = 0
  1665.     Set LoadResourcePicture = LoadPicture(sFile)
  1666.     KillFile sFile
  1667.     Erase b
  1668.     Err.Clear
  1669.     Exit Function
  1670. ErrorHandler:
  1671.     Dim lErr As Long
  1672.     Dim sErr As String
  1673.     lErr = Err.Number:   sErr = Err.Description
  1674.     If Not iFile = 0 Then Close #iFile
  1675.     KillFile sFile
  1676.     Err.Raise Err.Number, App.EXEName & ".LoadResourcePicture", Err.Description
  1677.     Err.Clear
  1678.     Exit Function
  1679.     Err.Clear
  1680. End Function
  1681. Private Sub KillFile(ByVal sFile As String)
  1682.     On Error Resume Next
  1683.     Kill sFile
  1684.     Err.Clear
  1685. End Sub
  1686. Public Sub Resize()
  1687.     On Error Resume Next
  1688.     Dim InicioArea As Long
  1689.     Dim area As Long
  1690.     Dim pos As Long
  1691.     UserControl.Height = Barra2.Height
  1692.     UserControl.Width = UserControl.ParentControls.Item(0).ScaleWidth
  1693.     'If TypeName(mParent) <> "Nothing" Then UserControl.Width = mParent.ScaleWidth
  1694.     Barra2.Width = UserControl.Width
  1695.     BarraRight.Left = Barra2.Width - BarraRight.Width
  1696.     ButtonRibbon.Top = 0
  1697.     ButtonRibbon.Left = 0
  1698.     ButtonRibbonoff.Top = 0
  1699.     ButtonRibbonover.Top = 0
  1700.     ButtonRibbonon.Top = 0
  1701.     ButtonRibbonoff.Left = 0
  1702.     ButtonRibbonover.Left = 0
  1703.     ButtonRibbonon.Left = 0
  1704.     Logo.Top = (ButtonRibbonoff.Height - Logo.Height) / 2
  1705.     Logo.Left = Logo.Top
  1706.     RibbonTop.Top = 0
  1707.     RibbonTop.Left = ButtonRibbonoff.Width
  1708.     If TotalTopButton >= 1 Then RibbonTopImage(TotalTopButton - 1).Top = (RibbonTop.Height - RibbonTopImage(TotalTopButton - 1).Height) / 2
  1709.     RibbonTop.Width = 330 * TotalTopButton
  1710.     RibbonTopRight.Top = 0
  1711.     RibbonTopRight.Left = RibbonTop.Left + RibbonTop.Width
  1712.     RibbonTopCustom.Top = 0
  1713.     RibbonTopCustom.Left = RibbonTopRight.Left + RibbonTopRight.Width
  1714.     RibbonTopCustom_over.Top = 0
  1715.     RibbonTopCustom_over.Left = RibbonTopCustom.Left
  1716.     If m_ShowCustomMenu = True Then
  1717.         RibbonTopCustom.Visible = True
  1718.         InicioArea = (RibbonTopCustom.Left + RibbonTopCustom.Width)
  1719.     Else
  1720.         RibbonTopCustom.Visible = False
  1721.         InicioArea = (RibbonTopRight.Left + RibbonTopRight.Width)
  1722.     End If
  1723.     area = UserControl.Width - (InicioArea + (Endoff.Width * 3))
  1724.     Barra.Left = InicioArea
  1725.     If area >= 0 Then Barra.Width = area
  1726.     pos = InStr(sCaption, " - ")
  1727.     If pos > 0 Then
  1728.         Titulo.Caption = Mid$(sCaption, 1, pos + 2)
  1729.         Titulo2.Caption = Mid$(sCaption, pos + 3)
  1730.         Titulo.Left = ((area - (Titulo.Width + Titulo2.Width)) / 2) + InicioArea
  1731.         Titulo2.Left = Titulo.Left + Titulo.Width
  1732.         Titulo2.Visible = True
  1733.     Else
  1734.         Titulo.Caption = sCaption
  1735.         Titulo.Left = ((area - Titulo.Width) / 2) + InicioArea
  1736.         Titulo2.Visible = False
  1737.     End If
  1738.     Endoff.Left = Barra2.Width - Endoff.Width
  1739.     Endon.Left = Endoff.Left
  1740.     Maxoff.Left = Endoff.Left - Maxoff.Width
  1741.     Maxon.Left = Maxoff.Left
  1742.     Minoff.Left = Maxoff.Left - Minoff.Width
  1743.     Minon.Left = Minoff.Left
  1744.     Err.Clear
  1745. End Sub
  1746. Public Property Let ImageList(ByVal zImageList As Variant)
  1747.     On Error Resume Next
  1748.     Set zImg = zImageList
  1749.     If TypeName(zImg) = "ImageList" Then
  1750.         iImgLType = 1
  1751.     ElseIf TypeName(zImageList) = "vbalImageList" Then
  1752.         iImgLType = 2
  1753.     Else
  1754.         iImgLType = 0
  1755.     End If
  1756.     Err.Clear
  1757. End Property
  1758. Public Property Let Icon(ByVal zPicture As Variant)
  1759.     On Error Resume Next
  1760.     Set Logo.Picture = zImg.ListImages.Item(GetIconIndex(zImg, zPicture)).Picture
  1761.     Err.Clear
  1762. End Property
  1763. Private Function GetIconIndex(zImg As Variant, iIcon As Variant) As Integer
  1764.     On Error Resume Next
  1765.     Dim i As Integer
  1766.     Dim iLCnt As Integer
  1767.     'Parameter NOT string or integer?
  1768.     If (VarType(iIcon) <> vbInteger) And (VarType(iIcon) <> vbString) Then
  1769.         GetIconIndex = -1
  1770.         Err.Clear
  1771.         Exit Function
  1772.     End If
  1773.     iLCnt = zImg.ListImages.Count
  1774.     'Key was passed
  1775.     If VarType(iIcon) = vbString Then
  1776.         'get icon index
  1777.         For i = 1 To iLCnt
  1778.             If LCase$(zImg.ListImages(i).Key) = LCase$(iIcon) Then
  1779.                 'we did find the Icons index
  1780.                 GetIconIndex = i
  1781.                 Err.Clear
  1782.                 Exit Function
  1783.             End If
  1784.         Next
  1785.         'when we got here the string doesn't match
  1786.         GetIconIndex = -1
  1787.         Err.Clear
  1788.         Exit Function
  1789.     End If
  1790.     'Index was passed
  1791.     If iIcon >= 1 Or iIcon <= iLCnt Then
  1792.         GetIconIndex = iIcon
  1793.     Else
  1794.         'RaiseWarning "GetIconIndex", "GetIconIndex: invalid Image Index."
  1795.         GetIconIndex = -1
  1796.     End If
  1797.     Err.Clear
  1798.     Exit Function
  1799. NoImage:
  1800.     'No imagelist was selected
  1801.     GetIconIndex = -1
  1802.     Err.Clear
  1803. End Function
  1804. 'Private Sub RaiseError(sErrorDescription As String)
  1805. '
  1806. '    MsgBox "An Error has occurred." & vbCrLf & sErrorDescription, vbCritical, "Ribbon"
  1807. '
  1808. 'End Sub
  1809. Public Property Set ParentForm(newForm As Variant)
  1810.     On Error Resume Next
  1811.     Set mParent = newForm
  1812.     Err.Clear
  1813. End Property
  1814. Public Property Set Font(newFont As StdFont)
  1815.     On Error Resume Next
  1816.     Dim tmpCtl As Control
  1817.     UserControl.Font.Name = newFont.Name
  1818.     UserControl.Font.Size = newFont.Size
  1819.     UserControl.Font.Charset = newFont.Charset
  1820.     For Each tmpCtl In UserControl.Controls
  1821.         tmpCtl.Font = newFont.Font
  1822.     Next
  1823.     UserControl.Refresh
  1824.     Err.Clear
  1825. End Property
  1826. Public Property Get Font() As StdFont
  1827.     On Error Resume Next
  1828.     Set Font = UserControl.Font
  1829.     Err.Clear
  1830. End Property
  1831. Private Sub ButMouse_MouseMove(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
  1832.     On Error Resume Next
  1833.     'Freeze
  1834.     Dim i As Long
  1835.     For i = 0 To ButMouse.UBound
  1836.         If i <> Index Then
  1837.             Button_left(i).Visible = False
  1838.             Button_center(i).Visible = False
  1839.             Button_right(i).Visible = False
  1840.             If Glip_off(i).Visible = True Then
  1841.                 Glip_on(i).Visible = False
  1842.             End If
  1843.         End If
  1844.     Next
  1845.     If Button_left(Index).Visible = False Then
  1846.         Button_left(Index).Visible = True
  1847.         Button_center(Index).Visible = True
  1848.         Button_right(Index).Visible = True
  1849.         If Glip_off(Index).Visible = True Then
  1850.             Glip_on(Index).Visible = True
  1851.         End If
  1852.     End If
  1853.     For i = 0 To CatMouse.UBound
  1854.         If Cat_Dlg(i).Visible = True Then
  1855.             Cat_Dlg_over(i).Visible = False
  1856.         End If
  1857.     Next
  1858.     For i = 0 To TabMouse.UBound
  1859.         Tab_center_over(i).Visible = False
  1860.         Tab_left_over(i).Visible = False
  1861.         Tab_right_over(i).Visible = False
  1862.     Next
  1863.     For i = 0 To TBMouse.UBound
  1864.         RibbonTop_over(i).Visible = False
  1865.     Next
  1866.     RibbonTopCustom_over.Visible = False
  1867.     Endon.Visible = False
  1868.     Maxon.Visible = False
  1869.     Minon.Visible = False
  1870.     ButtonRibbonover.Visible = False
  1871.     ButtonRibbonon.Visible = False
  1872.     'Freeze False
  1873.     Err.Clear
  1874. End Sub
  1875. Private Sub ButtonRibbon_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
  1876.     On Error Resume Next
  1877.     'Freeze
  1878.     Dim i As Integer
  1879.     Dim KL As Integer
  1880.     ButtonRibbonover.Visible = True
  1881.     ButtonRibbonon.Visible = False
  1882.     For i = 0 To CatMouse.UBound
  1883.         Cat_Center_on(i).Visible = False
  1884.         Cat_Left_on(i).Visible = False
  1885.         Cat_Right_on(i).Visible = False
  1886.         If Cat_Dlg(i).Visible = True Then
  1887.             Cat_Dlg_on(i).Visible = False
  1888.             Cat_Dlg_over(i).Visible = False
  1889.         End If
  1890.     Next
  1891.     For i = 0 To TabMouse.UBound
  1892.         Tab_center_over(i).Visible = False
  1893.         Tab_left_over(i).Visible = False
  1894.         Tab_right_over(i).Visible = False
  1895.     Next
  1896.     For KL = 0 To ButMouse.UBound
  1897.         Button_left(KL).Visible = False
  1898.         Button_right(KL).Visible = False
  1899.         Button_center(KL).Visible = False
  1900.     Next
  1901.     For i = 0 To TBMouse.UBound
  1902.         RibbonTop_over(i).Visible = False
  1903.     Next
  1904.     RibbonTopCustom_over.Visible = False
  1905.     Endon.Visible = False
  1906.     Maxon.Visible = False
  1907.     Minon.Visible = False
  1908.     'Freeze False
  1909.     Err.Clear
  1910. End Sub
  1911. Private Sub Cat_Dlg_on_MouseMove(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
  1912.     On Error Resume Next
  1913.     'Freeze
  1914.     Dim KL As Integer
  1915.     Cat_Dlg_over(Index).Visible = True
  1916.     For KL = 0 To ButMouse.UBound
  1917.         Button_left(KL).Visible = False
  1918.         Button_right(KL).Visible = False
  1919.         Button_center(KL).Visible = False
  1920.     Next
  1921.     'Freeze False
  1922.     Err.Clear
  1923. End Sub
  1924. Private Sub CatMouse_Click(Index As Integer)
  1925.     On Error Resume Next
  1926.     'Freeze
  1927.     Dim i As Integer
  1928.     For i = 0 To CatMouse.UBound
  1929.         Cat_Center_on(i).Visible = False
  1930.         Cat_Left_on(i).Visible = False
  1931.         Cat_Right_on(i).Visible = False
  1932.     Next
  1933.     Cat_Center_on(Index).Visible = True
  1934.     Cat_Left_on(Index).Visible = True
  1935.     Cat_Right_on(Index).Visible = True
  1936.     'Freeze False
  1937.     Err.Clear
  1938. End Sub
  1939. Private Sub CatMouse_MouseMove(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
  1940.     On Error Resume Next
  1941.     'Freeze
  1942.     Dim i As Integer
  1943.     Dim KL As Integer
  1944.     For i = 0 To CatMouse.UBound
  1945.         If i = Index Then
  1946.             If Cat_Center_on(i).Visible = False Then
  1947.                 Cat_Center_on(Index).Visible = True
  1948.                 Cat_Left_on(Index).Visible = True
  1949.                 Cat_Right_on(Index).Visible = True
  1950.                 If Cat_Dlg(i).Visible = True Then
  1951.                     Cat_Dlg_on(Index).Visible = True
  1952.                 End If
  1953.             End If
  1954.         Else
  1955.             Cat_Center_on(i).Visible = False
  1956.             Cat_Left_on(i).Visible = False
  1957.             Cat_Right_on(i).Visible = False
  1958.             If Cat_Dlg(i).Visible = True Then
  1959.                 Cat_Dlg_on(i).Visible = False
  1960.                 Cat_Dlg_over(i).Visible = False
  1961.             End If
  1962.         End If
  1963.         If Cat_Dlg(i).Visible = True Then
  1964.             Cat_Dlg_over(i).Visible = False
  1965.         End If
  1966.     Next
  1967.     For KL = 0 To ButMouse.UBound
  1968.         Button_left(KL).Visible = False
  1969.         Button_right(KL).Visible = False
  1970.         Button_center(KL).Visible = False
  1971.     Next
  1972.     For i = 0 To TabMouse.UBound
  1973.         Tab_center_over(i).Visible = False
  1974.         Tab_left_over(i).Visible = False
  1975.         Tab_right_over(i).Visible = False
  1976.     Next
  1977.     For i = 0 To TBMouse.UBound
  1978.         RibbonTop_over(i).Visible = False
  1979.     Next
  1980.     RibbonTopCustom_over.Visible = False
  1981.     Endon.Visible = False
  1982.     Maxon.Visible = False
  1983.     Minon.Visible = False
  1984.     ButtonRibbonover.Visible = False
  1985.     ButtonRibbonon.Visible = False
  1986.     'Freeze False
  1987.     Err.Clear
  1988. End Sub
  1989. Private Sub Minoff_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
  1990.     On Error Resume Next
  1991.     'Freeze
  1992.     Dim i As Integer
  1993.     Dim KL As Integer
  1994.     Endon.Visible = False
  1995.     Maxon.Visible = False
  1996.     Minon.Visible = True
  1997.     For i = 0 To TabMouse.UBound
  1998.         Tab_center_over(i).Visible = False
  1999.         Tab_left_over(i).Visible = False
  2000.         Tab_right_over(i).Visible = False
  2001.     Next
  2002.     For i = 0 To CatMouse.UBound
  2003.         Cat_Center_on(i).Visible = False
  2004.         Cat_Left_on(i).Visible = False
  2005.         Cat_Right_on(i).Visible = False
  2006.         If Cat_Dlg(i).Visible = True Then
  2007.             Cat_Dlg_on(i).Visible = False
  2008.             Cat_Dlg_over(i).Visible = False
  2009.         End If
  2010.     Next
  2011.     For KL = 0 To ButMouse.UBound
  2012.         Button_left(KL).Visible = False
  2013.         Button_right(KL).Visible = False
  2014.         Button_center(KL).Visible = False
  2015.     Next
  2016.     For i = 0 To TBMouse.UBound
  2017.         RibbonTop_over(i).Visible = False
  2018.     Next
  2019.     RibbonTopCustom_over.Visible = False
  2020.     ButtonRibbonover.Visible = False
  2021.     ButtonRibbonon.Visible = False
  2022.     'Freeze False
  2023.     Err.Clear
  2024. End Sub
  2025. Private Sub Maxoff_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
  2026.     On Error Resume Next
  2027.     'Freeze
  2028.     Dim i As Integer
  2029.     Dim KL As Integer
  2030.     Endon.Visible = False
  2031.     Maxon.Visible = True
  2032.     Minon.Visible = False
  2033.     For i = 0 To TabMouse.UBound
  2034.         Tab_center_over(i).Visible = False
  2035.         Tab_left_over(i).Visible = False
  2036.         Tab_right_over(i).Visible = False
  2037.     Next
  2038.     For i = 0 To CatMouse.UBound
  2039.         Cat_Center_on(i).Visible = False
  2040.         Cat_Left_on(i).Visible = False
  2041.         Cat_Right_on(i).Visible = False
  2042.         If Cat_Dlg(i).Visible = True Then
  2043.             Cat_Dlg_on(i).Visible = False
  2044.             Cat_Dlg_over(i).Visible = False
  2045.         End If
  2046.     Next
  2047.     For KL = 0 To ButMouse.UBound
  2048.         Button_left(KL).Visible = False
  2049.         Button_right(KL).Visible = False
  2050.         Button_center(KL).Visible = False
  2051.     Next
  2052.     For i = 0 To TBMouse.UBound
  2053.         RibbonTop_over(i).Visible = False
  2054.     Next
  2055.     RibbonTopCustom_over.Visible = False
  2056.     ButtonRibbonover.Visible = False
  2057.     ButtonRibbonon.Visible = False
  2058.     'Freeze False
  2059.     Err.Clear
  2060. End Sub
  2061. Private Sub Endoff_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
  2062.     On Error Resume Next
  2063.     'Freeze
  2064.     Dim i As Integer
  2065.     Dim KL As Integer
  2066.     Endon.Visible = True
  2067.     Maxon.Visible = False
  2068.     Minon.Visible = False
  2069.     For i = 0 To TabMouse.UBound
  2070.         Tab_center_over(i).Visible = False
  2071.         Tab_left_over(i).Visible = False
  2072.         Tab_right_over(i).Visible = False
  2073.     Next
  2074.     For i = 0 To CatMouse.UBound
  2075.         Cat_Center_on(i).Visible = False
  2076.         Cat_Left_on(i).Visible = False
  2077.         Cat_Right_on(i).Visible = False
  2078.         If Cat_Dlg(i).Visible = True Then
  2079.             Cat_Dlg_on(i).Visible = False
  2080.             Cat_Dlg_over(i).Visible = False
  2081.         End If
  2082.     Next
  2083.     For KL = 0 To ButMouse.UBound
  2084.         Button_left(KL).Visible = False
  2085.         Button_right(KL).Visible = False
  2086.         Button_center(KL).Visible = False
  2087.     Next
  2088.     For i = 0 To TBMouse.UBound
  2089.         RibbonTop_over(i).Visible = False
  2090.     Next
  2091.     RibbonTopCustom_over.Visible = False
  2092.     ButtonRibbonover.Visible = False
  2093.     ButtonRibbonon.Visible = False
  2094.     'Freeze False
  2095.     Err.Clear
  2096. End Sub
  2097. Private Sub RibbonTopCustom_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
  2098.     On Error Resume Next
  2099.     'Freeze
  2100.     Dim i As Integer
  2101.     Dim KL As Integer
  2102.     RibbonTopCustom_over.Visible = True
  2103.     For i = 0 To CatMouse.UBound
  2104.         Cat_Center_on(i).Visible = False
  2105.         Cat_Left_on(i).Visible = False
  2106.         Cat_Right_on(i).Visible = False
  2107.         If Cat_Dlg(i).Visible = True Then
  2108.             Cat_Dlg_on(i).Visible = False
  2109.             Cat_Dlg_over(i).Visible = False
  2110.         End If
  2111.     Next
  2112.     For i = 0 To TabMouse.UBound
  2113.         Tab_center_over(i).Visible = False
  2114.         Tab_left_over(i).Visible = False
  2115.         Tab_right_over(i).Visible = False
  2116.     Next
  2117.     For KL = 0 To ButMouse.UBound
  2118.         Button_left(KL).Visible = False
  2119.         Button_right(KL).Visible = False
  2120.         Button_center(KL).Visible = False
  2121.     Next
  2122.     For i = 0 To TBMouse.UBound
  2123.         RibbonTop_over(i).Visible = False
  2124.     Next
  2125.     ButtonRibbonover.Visible = False
  2126.     ButtonRibbonon.Visible = False
  2127.     Endon.Visible = False
  2128.     Maxon.Visible = False
  2129.     Minon.Visible = False
  2130.     'Freeze False
  2131.     Err.Clear
  2132. End Sub
  2133. Private Sub RibbonTopRight_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
  2134.     On Error Resume Next
  2135.     'Freeze
  2136.     Dim i As Integer
  2137.     Dim KL As Integer
  2138.     RibbonTopCustom_over.Visible = False
  2139.     For i = 0 To CatMouse.UBound
  2140.         Cat_Center_on(i).Visible = False
  2141.         Cat_Left_on(i).Visible = False
  2142.         Cat_Right_on(i).Visible = False
  2143.         If Cat_Dlg(i).Visible = True Then
  2144.             Cat_Dlg_on(i).Visible = False
  2145.             Cat_Dlg_over(i).Visible = False
  2146.         End If
  2147.     Next
  2148.     For i = 0 To TabMouse.UBound
  2149.         Tab_center_over(i).Visible = False
  2150.         Tab_left_over(i).Visible = False
  2151.         Tab_right_over(i).Visible = False
  2152.     Next
  2153.     For KL = 0 To ButMouse.UBound
  2154.         Button_left(KL).Visible = False
  2155.         Button_right(KL).Visible = False
  2156.         Button_center(KL).Visible = False
  2157.     Next
  2158.     For i = 0 To TBMouse.UBound
  2159.         RibbonTop_over(i).Visible = False
  2160.     Next
  2161.     ButtonRibbonover.Visible = False
  2162.     ButtonRibbonon.Visible = False
  2163.     Endon.Visible = False
  2164.     Maxon.Visible = False
  2165.     Minon.Visible = False
  2166.     'Freeze False
  2167.     Err.Clear
  2168. End Sub
  2169. Private Sub TabMouse_Click(Index As Integer)
  2170.     On Error Resume Next
  2171.     Dim i As Integer
  2172.     For i = 0 To TabMouse.UBound
  2173.         Tab_center_over(i).Visible = False
  2174.         Tab_left_over(i).Visible = False
  2175.         Tab_right_over(i).Visible = False
  2176.         Tab_center(i).Visible = False
  2177.         Tab_left(i).Visible = False
  2178.         Tab_right(i).Visible = False
  2179.         Tab_caption(i).ForeColor = TAB_NORMAL
  2180.     Next
  2181.     Tab_caption(Index).ForeColor = TAB_SELECTED
  2182.     Tab_center(Index).Visible = True
  2183.     Tab_left(Index).Visible = True
  2184.     Tab_right(Index).Visible = True
  2185.     TabSelected = TabButtons(Index).TabID
  2186.     CatsUpdate
  2187.     RaiseEvent TabClick(TabButtons(Index).TabID, TabButtons(Index).TabCaption)
  2188.     Tab_right(Index).ZOrder 0
  2189.     'Me.DisableUpdates False
  2190.     Err.Clear
  2191. End Sub
  2192. Public Sub TabSelect(Index As Integer)
  2193.     On Error Resume Next
  2194.     Dim i As Integer
  2195.     For i = 0 To TabMouse.UBound
  2196.         Tab_center_over(i).Visible = False
  2197.         Tab_left_over(i).Visible = False
  2198.         Tab_right_over(i).Visible = False
  2199.         Tab_center(i).Visible = False
  2200.         Tab_left(i).Visible = False
  2201.         Tab_right(i).Visible = False
  2202.         Tab_caption(i).ForeColor = TAB_NORMAL
  2203.     Next
  2204.     Tab_caption(Index).ForeColor = TAB_SELECTED
  2205.     Tab_center(Index).Visible = True
  2206.     Tab_left(Index).Visible = True
  2207.     Tab_right(Index).Visible = True
  2208.     TabSelected = TabButtons(Index).TabID
  2209.     Err.Clear
  2210. End Sub
  2211. Private Sub TabMouse_MouseMove(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
  2212.     On Error Resume Next
  2213.     'Freeze
  2214.     Dim i As Integer
  2215.     Dim KL As Integer
  2216.     For i = 0 To TabMouse.UBound
  2217.         If i = Index Then
  2218.             If Tab_center(i).Visible = False Then
  2219.                 Tab_center_over(Index).Visible = True
  2220.                 Tab_left_over(Index).Visible = True
  2221.                 Tab_right_over(Index).Visible = True
  2222.             End If
  2223.         Else
  2224.             Tab_center_over(i).Visible = False
  2225.             Tab_left_over(i).Visible = False
  2226.             Tab_right_over(i).Visible = False
  2227.         End If
  2228.     Next
  2229.     For i = 0 To CatMouse.UBound
  2230.         Cat_Center_on(i).Visible = False
  2231.         Cat_Left_on(i).Visible = False
  2232.         Cat_Right_on(i).Visible = False
  2233.         If Cat_Dlg(i).Visible = True Then
  2234.             Cat_Dlg_on(i).Visible = False
  2235.             Cat_Dlg_over(i).Visible = False
  2236.         End If
  2237.     Next
  2238.     For KL = 0 To ButMouse.UBound
  2239.         Button_left(KL).Visible = False
  2240.         Button_right(KL).Visible = False
  2241.         Button_center(KL).Visible = False
  2242.     Next
  2243.     For i = 0 To TBMouse.UBound
  2244.         RibbonTop_over(i).Visible = False
  2245.     Next
  2246.     RibbonTopCustom_over.Visible = False
  2247.     Endon.Visible = False
  2248.     Maxon.Visible = False
  2249.     Minon.Visible = False
  2250.     ButtonRibbonover.Visible = False
  2251.     ButtonRibbonon.Visible = False
  2252.     'Freeze False
  2253.     Err.Clear
  2254. End Sub
  2255. Private Sub TBMouse_MouseMove(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
  2256.     On Error Resume Next
  2257.     'Freeze
  2258.     Dim i As Integer
  2259.     Dim KL As Integer
  2260.     For i = 0 To TBMouse.UBound
  2261.         RibbonTop_over(i).Visible = False
  2262.     Next
  2263.     RibbonTop_over(Index).Visible = True
  2264.     For i = 0 To TabMouse.UBound
  2265.         Tab_center_over(i).Visible = False
  2266.         Tab_left_over(i).Visible = False
  2267.         Tab_right_over(i).Visible = False
  2268.     Next
  2269.     For KL = 0 To ButMouse.UBound
  2270.         Button_left(KL).Visible = False
  2271.         Button_right(KL).Visible = False
  2272.         Button_center(KL).Visible = False
  2273.     Next
  2274.     For i = 0 To CatMouse.UBound
  2275.         Cat_Center_on(i).Visible = False
  2276.         Cat_Left_on(i).Visible = False
  2277.         Cat_Right_on(i).Visible = False
  2278.         If Cat_Dlg(i).Visible = True Then
  2279.             Cat_Dlg_on(i).Visible = False
  2280.             Cat_Dlg_over(i).Visible = False
  2281.         End If
  2282.     Next
  2283.     RibbonTopCustom_over.Visible = False
  2284.     Endon.Visible = False
  2285.     Maxon.Visible = False
  2286.     Minon.Visible = False
  2287.     ButtonRibbonover.Visible = False
  2288.     ButtonRibbonon.Visible = False
  2289.     'Freeze False
  2290.     Err.Clear
  2291. End Sub
  2292. Private Sub TabsUpdate()
  2293.     On Error Resume Next
  2294.     Dim i As Integer
  2295.     Dim tTabs As Integer
  2296.     tTabs = Tab_caption.Count - 1
  2297.     If tTabs >= 1 Then
  2298.         For i = 1 To tTabs
  2299.             Unload Tab_caption(i)
  2300.             Unload Tab_left(i)
  2301.             Unload Tab_center(i)
  2302.             Unload Tab_right(i)
  2303.             Unload Tab_left_over(i)
  2304.             Unload Tab_center_over(i)
  2305.             Unload Tab_right_over(i)
  2306.             Unload TabMouse(i)
  2307.         Next
  2308.     End If
  2309.     'DoEvents
  2310.     For i = 0 To (TotalTabs - 1)
  2311.         If i <> 0 Then
  2312.             Load Tab_caption(i)
  2313.             Load Tab_left(i)
  2314.             Load Tab_center(i)
  2315.             Load Tab_right(i)
  2316.             Load Tab_left_over(i)
  2317.             Load Tab_center_over(i)
  2318.             Load Tab_right_over(i)
  2319.             Load TabMouse(i)
  2320.             Tab_left(i).Left = Tab_right(i - 1).Left + Tab_right(i).Width
  2321.         Else
  2322.             Tab_left(0).Left = ButtonRibbon.Width
  2323.         End If
  2324.         TabMouse(i).Left = Tab_left(i).Left
  2325.         Tab_caption(i).Top = 395 + 60
  2326.         Tab_center(i).Top = 395
  2327.         Tab_left(i).Top = 395
  2328.         Tab_right(i).Top = 395
  2329.         Tab_center_over(i).Top = 395
  2330.         Tab_left_over(i).Top = 395
  2331.         Tab_right_over(i).Top = 395
  2332.         TabMouse(i).Top = 395
  2333.         Tab_caption(i) = TabButtons(i).TabCaption
  2334.         Tab_center(i).Width = Tab_caption(i).Width
  2335.         Tab_center(i).Left = Tab_left(i).Left + Tab_left(i).Width
  2336.         Tab_caption(i).Left = Tab_center(i).Left
  2337.         Tab_right(i).Left = Tab_center(i).Left + Tab_center(i).Width
  2338.         Tab_center_over(i).Width = Tab_center(i).Width
  2339.         Tab_center_over(i).Left = Tab_center(i).Left
  2340.         Tab_left_over(i).Left = Tab_left(i).Left
  2341.         Tab_right_over(i).Left = Tab_right(i).Left
  2342.         TabMouse(i).Width = Tab_left(i).Width + Tab_right(i).Width + Tab_center(i).Width
  2343.         Tab_caption(i).ForeColor = TAB_NORMAL
  2344.         Tab_caption(i).Visible = True
  2345.         If i = 0 Then
  2346.             Tab_center(i).Visible = True
  2347.             Tab_left(i).Visible = True
  2348.             Tab_right(i).Visible = True
  2349.             Tab_caption(i).ForeColor = TAB_SELECTED
  2350.         End If
  2351.         TabMouse(i).Visible = TabButtons(i).TabVisible
  2352.         Tab_center(i).ZOrder 0
  2353.         Tab_left(i).ZOrder 0
  2354.         Tab_right(i).ZOrder 0
  2355.         Tab_center_over(i).ZOrder 0
  2356.         Tab_left_over(i).ZOrder 0
  2357.         Tab_right_over(i).ZOrder 0
  2358.         Tab_caption(i).ZOrder 0
  2359.         TabMouse(i).ZOrder 0
  2360.     Next
  2361.     Err.Clear
  2362. End Sub
  2363. Private Sub CatsUpdate()
  2364.     On Error Resume Next
  2365.     Dim TotalCatsT As Integer
  2366.     Dim CatsIDT() As String
  2367.     Dim CatsCT() As String
  2368.     Dim CatsTT() As String
  2369.     Dim CatsDT() As Boolean
  2370.     Dim CatsToolT() As String
  2371.     Dim i As Integer
  2372.     Dim BUTSIZE As Integer
  2373.     Dim KL As Integer
  2374.     ReDim CatsIDT(TotalCats) As String
  2375.     ReDim CatsCT(TotalCats) As String
  2376.     ReDim CatsTT(TotalCats) As String
  2377.     ReDim CatsDT(TotalCats) As Boolean
  2378.     ReDim CatsToolT(TotalCats) As String
  2379.     TotalCatsT = 0
  2380.     For i = 0 To TotalCats - 1
  2381.         If CategoryButtons(i).CatsT = TabSelected And TabSelected <> """" And CategoryButtons(i).CatsT <> """" Then
  2382.             CatsIDT(TotalCatsT) = CategoryButtons(i).CatsID
  2383.             CatsTT(TotalCatsT) = CategoryButtons(i).CatsT
  2384.             CatsCT(TotalCatsT) = CategoryButtons(i).CatsC
  2385.             CatsDT(TotalCatsT) = CategoryButtons(i).CatsD
  2386.             CatsToolT(TotalCatsT) = CategoryButtons(i).CatsTool
  2387.             TotalCatsT = TotalCatsT + 1
  2388.         End If
  2389.     Next
  2390.     'DoEvents
  2391.     If CatMouse.UBound >= 1 Then
  2392.         For i = 1 To CatMouse.UBound
  2393.             Unload Cat_Left_off(i)
  2394.             Unload Cat_Left_on(i)
  2395.             Unload Cat_Right_off(i)
  2396.             Unload Cat_Right_on(i)
  2397.             Unload Cat_Center_off(i)
  2398.             Unload Cat_Center_on(i)
  2399.             Unload Cat_Caption(i)
  2400.             Unload CatMouse(i)
  2401.             Unload Cat_Dlg(i)
  2402.             Unload Cat_Dlg_on(i)
  2403.             Unload Cat_Dlg_over(i)
  2404.         Next
  2405.     End If
  2406.     'DoEvents
  2407.     If Button_center.UBound >= 1 Then
  2408.         For i = 1 To Button_center.UBound
  2409.             Unload Button_left(i)
  2410.             Unload Button_center(i)
  2411.             Unload Button_right(i)
  2412.             Unload Button_left_over(i)
  2413.             Unload Button_center_over(i)
  2414.             Unload Button_right_over(i)
  2415.             Unload Button_Caption(i)
  2416.             Unload Button_Icon(i)
  2417.             Unload Button_Text(i)
  2418.             Unload Glip_on(i)
  2419.             Unload Glip_off(i)
  2420.             Unload ButMouse(i)
  2421.             Unload txtBox(i)
  2422.             Unload cboBox(i)
  2423.             Unload datePick(i)
  2424.             Unload progBar(i)
  2425.         Next
  2426.     End If
  2427.     Button_left(0).Visible = False
  2428.     Button_center(0).Visible = False
  2429.     Button_right(0).Visible = False
  2430.     Button_Caption(0).Visible = False
  2431.     Button_Icon(0).Visible = False
  2432.     Button_Text(0).Visible = False
  2433.     txtBox(0).Visible = False
  2434.     cboBox(0).Visible = False
  2435.     datePick(0).Visible = False
  2436.     progBar(0).Visible = False
  2437.     ButMouse(0).Visible = False
  2438.     Cat_Left_off(0).Visible = False
  2439.     Cat_Left_on(0).Visible = False
  2440.     Cat_Right_off(0).Visible = False
  2441.     Cat_Right_on(0).Visible = False
  2442.     Cat_Center_off(0).Visible = False
  2443.     Cat_Center_on(0).Visible = False
  2444.     Cat_Caption(0).Visible = False
  2445.     CatMouse(0).Visible = False
  2446.     Cat_Dlg(0).Visible = False
  2447.     Cat_Dlg_on(0).Visible = False
  2448.     Cat_Dlg_over(0).Visible = False
  2449.     For i = 0 To (TotalCatsT - 1)
  2450.         If i <> 0 Then
  2451.             Load Cat_Left_off(i)
  2452.             Load Cat_Left_on(i)
  2453.             Load Cat_Right_off(i)
  2454.             Load Cat_Right_on(i)
  2455.             Load Cat_Center_off(i)
  2456.             Load Cat_Center_on(i)
  2457.             Load Cat_Caption(i)
  2458.             Load CatMouse(i)
  2459.             Load Cat_Dlg(i)
  2460.             Load Cat_Dlg_on(i)
  2461.             Load Cat_Dlg_over(i)
  2462.             Cat_Left_off(i).Left = Cat_Right_off(i - 1).Left + Cat_Right_off(i).Width
  2463.         Else
  2464.             Cat_Left_off(i).Left = 120
  2465.         End If
  2466.         CatMouse(i).Left = Cat_Left_off(i).Left
  2467.         Cat_Caption(i).Caption = CatsCT(i)
  2468.         Cat_Caption(i).Tag = CatsIDT(i)
  2469.         Cat_Center_off(i).Left = Cat_Left_off(i).Left + Cat_Left_off(i).Width
  2470.         BUTSIZE = ButtonsUpdate(CatsIDT(i), Cat_Center_off(i).Left)
  2471.         If CatsDT(i) = True Then
  2472.             Cat_Center_off(i).Width = Cat_Caption(i).Width + Cat_Dlg(i).Width
  2473.         Else
  2474.             Cat_Center_off(i).Width = Cat_Caption(i).Width
  2475.         End If
  2476.         If Cat_Center_off(i).Width < BUTSIZE Then
  2477.             Cat_Center_off(i).Width = BUTSIZE
  2478.             Cat_Caption(i).Left = Cat_Center_off(i).Left + ((Cat_Center_off(i).Width - Cat_Caption(i).Width) / 2)
  2479.         Else
  2480.             Cat_Caption(i).Left = Cat_Center_off(i).Left
  2481.         End If
  2482.         Cat_Right_off(i).Left = Cat_Center_off(i).Left + Cat_Center_off(i).Width
  2483.         Cat_Center_on(i).Width = Cat_Center_off(i).Width
  2484.         Cat_Center_on(i).Left = Cat_Center_off(i).Left
  2485.         Cat_Left_on(i).Left = Cat_Left_off(i).Left
  2486.         Cat_Right_on(i).Left = Cat_Right_off(i).Left
  2487.         CatMouse(i).Width = Cat_Left_off(i).Width + Cat_Right_off(i).Width + Cat_Center_off(i).Width
  2488.         Cat_Caption(i).Visible = True
  2489.         Cat_Center_off(i).Visible = True
  2490.         Cat_Left_off(i).Visible = True
  2491.         Cat_Right_off(i).Visible = True
  2492.         CatMouse(i).Visible = True
  2493.         Cat_Center_off(i).ZOrder 0
  2494.         Cat_Left_off(i).ZOrder 0
  2495.         Cat_Right_off(i).ZOrder 0
  2496.         Cat_Center_on(i).ZOrder 0
  2497.         Cat_Left_on(i).ZOrder 0
  2498.         Cat_Right_on(i).ZOrder 0
  2499.         Cat_Caption(i).ZOrder 0
  2500.         CatMouse(i).ZOrder 0
  2501.         Cat_Dlg(i).Left = (Cat_Right_off(i).Left - Cat_Dlg(i).Width) + 15
  2502.         Cat_Dlg(i).Top = (Cat_Right_off(i).Top + Cat_Right_off(i).Height) - (Cat_Dlg(i).Height + 60)
  2503.         Cat_Dlg_on(i).Left = Cat_Dlg(i).Left
  2504.         Cat_Dlg_over(i).Left = Cat_Dlg(i).Left
  2505.         Cat_Dlg_on(i).Top = Cat_Dlg(i).Top
  2506.         Cat_Dlg_over(i).Top = Cat_Dlg(i).Top
  2507.         Cat_Dlg_on(i).Visible = False
  2508.         Cat_Dlg_over(i).Visible = False
  2509.         If CatsDT(i) = True Then
  2510.             Cat_Dlg(i).Visible = True
  2511.         End If
  2512.         Cat_Dlg(i).ZOrder 0
  2513.         Cat_Dlg_on(i).ZOrder 0
  2514.         Cat_Dlg_over(i).ZOrder 0
  2515.         Cat_Dlg(i).ToolTipText = CatsToolT(i)
  2516.         Cat_Dlg_on(i).ToolTipText = CatsToolT(i)
  2517.         Cat_Dlg_over(i).ToolTipText = CatsToolT(i)
  2518.     Next
  2519.     'DoEvents
  2520.     For KL = 0 To ButMouse.UBound
  2521.         Button_left(KL).Visible = False
  2522.         Button_left(KL).ZOrder 0
  2523.         Button_right(KL).Visible = False
  2524.         Button_right(KL).ZOrder 0
  2525.         Button_center(KL).Visible = False
  2526.         Button_center(KL).ZOrder 0
  2527.         Button_left_over(KL).Visible = False
  2528.         Button_left_over(KL).ZOrder 0
  2529.         Button_right_over(KL).Visible = False
  2530.         Button_right_over(KL).ZOrder 0
  2531.         Button_center_over(KL).Visible = False
  2532.         Button_center_over(KL).ZOrder 0
  2533.         Button_Icon(KL).ZOrder 0
  2534.         Button_Text(KL).ZOrder 0
  2535.         txtBox(KL).ZOrder 0
  2536.         cboBox(KL).ZOrder 0
  2537.         datePick(KL).ZOrder 0
  2538.         progBar(KL).ZOrder 0
  2539.         Button_Caption(KL).ZOrder 0
  2540.         Glip_off(KL).ZOrder 0
  2541.         Glip_on(KL).ZOrder 0
  2542.         ButMouse(KL).ZOrder 0
  2543.     Next
  2544.     ComboBoxRefresh
  2545.     Err.Clear
  2546. End Sub
  2547. Public Sub Clear()
  2548.     On Error Resume Next
  2549.     'clear the ribbon
  2550.     TotalButton = 0
  2551.     TotalCats = 0
  2552.     TotalTabs = 0
  2553.     TotalTopButton = 0
  2554.     ImageList = Nothing
  2555.     txtBox(0).Text = ""
  2556.     cboBox(0).Clear
  2557.     progBar(0).Max = 100
  2558.     progBar(0).Min = 0
  2559.     progBar(0).Value = 0
  2560.     cboMaster.Clear
  2561.     cboMenus.Clear
  2562.     Dim i As Integer
  2563.     For i = 1 To RibbonTopImage.UBound
  2564.         Unload RibbonTopImage(i)
  2565.     Next
  2566.     For i = 1 To RibbonTop_over.UBound
  2567.         Unload RibbonTop_over(i)
  2568.     Next
  2569.     For i = 1 To TBMouse.UBound
  2570.         Unload TBMouse(i)
  2571.     Next
  2572.     For i = 1 To (TotalTabs - 1)
  2573.         Unload Tab_caption(i)
  2574.         Unload Tab_left(i)
  2575.         Unload Tab_center(i)
  2576.         Unload Tab_right(i)
  2577.         Unload Tab_left_over(i)
  2578.         Unload Tab_center_over(i)
  2579.         Unload Tab_right_over(i)
  2580.         Unload TabMouse(i)
  2581.     Next
  2582.     For i = 1 To CatMouse.UBound
  2583.         Unload Cat_Left_off(i)
  2584.         Unload Cat_Left_on(i)
  2585.         Unload Cat_Right_off(i)
  2586.         Unload Cat_Right_on(i)
  2587.         Unload Cat_Center_off(i)
  2588.         Unload Cat_Center_on(i)
  2589.         Unload Cat_Caption(i)
  2590.         Unload CatMouse(i)
  2591.         Unload Cat_Dlg(i)
  2592.         Unload Cat_Dlg_on(i)
  2593.         Unload Cat_Dlg_over(i)
  2594.     Next
  2595.     For i = 1 To Button_center.UBound
  2596.         Unload Button_left(i)
  2597.         Unload Button_center(i)
  2598.         Unload Button_right(i)
  2599.         Unload Button_left_over(i)
  2600.         Unload Button_center_over(i)
  2601.         Unload Button_right_over(i)
  2602.         Unload Button_Caption(i)
  2603.         Unload Button_Icon(i)
  2604.         Unload Button_Text(i)
  2605.         Unload Glip_on(i)
  2606.         Unload Glip_off(i)
  2607.         Unload ButMouse(i)
  2608.         Unload txtBox(i)
  2609.         Unload cboBox(i)
  2610.         Unload datePick(i)
  2611.         Unload progBar(i)
  2612.     Next
  2613.     Err.Clear
  2614. End Sub
  2615. Public Function TabSearch(ByVal zID As String) As Integer
  2616.     On Error Resume Next
  2617.     ' 2ar
  2618. End Sub
  2619. Public Function Ta      Load Cat_Lefund
  2620.   =leat_Right_off(i).Top + Cat_Riunction TabSearch(ByVal zIDt_Lefu  + Cat_Riunction TabSearch(ByVal zIDt_Lefua.Wi       st_Left =  Gl Cat_Dlg_or_over(i_off(i)
  2621.         Unler, Button "n
  2622.     Err.Clear
  2623. EndgDLefua.WieotalButtonrAhen
  2624.             Cat  Err.Clear
  2625. EndgDLefua.WieotalButtonrAhet_off(i).Height)Err.Clear
  2626.  use.UBound
  2627.         RiogBar(0)._center(i).Width = Tab_caption(i).Width
  2628.         Tab_center(i).Left = Tab_left(i).Left + Tab_left(i).Width
  2629.         Tab_caption(i).Leth =      U(0)._cent            Load Cat_Centa        utMouse(i)
  2630.         Unload txte    nd
  2631. )._cent               nd
  2632. )._cent        ad txte    nd
  2633. )._cent               nd
  2634. (i).Lefuse(i)
  2635.   Ls Integer
  2636.     a=t
  2637.     ' 2ar
  2638.     otalTabs = 0
  2639.  vton_left(i)
  2640.     .car
  2641. EndgDLefua.WieotalButtonrAhet_off(i).Height)Err.Clear
  2642.  use.UBound
  2643.         RiogBar(0)._center(i).Width = Tab_caption(i).Width
  2644.         Tab_center(i).Left = Tab_left(i).Left + ar
  2645.   ).Width = Tab_s+ ar
  2646.   ).Width = Ta
  2647.     Fora  RiogBar    Foi   CatsIDT(Total RiogBar(0)._cente Unload Tab_center(i)
  2648.             Un   otalTabsad Cai   On Error Resume Nr 0
  2649.         CatMouse(i).ZOrder 0
  2650.         Ca).W2Function
  2651.     Nr 0
  2652.         CatMo   Ca).W2Function
  2653.     Nr 0
  2654.            _off(i).HeiL  Button_left_over(KL).Visibla
  2655. EndgDLr_off(i).Width = BUTSIZE
  2656.             d
  2657.         Unload TBMouse(i(.WidthiLefua.Wi       st_Left =  Gl_off(i).Widtuse.(KL).Visidth) + 15
  2658.   efua.Wi       entedtuse.(KL).Visidth) +      If i = 0 Then
  2659.            Intege     Cat_Right__off(i).Left - Cat_Dlg(i).WiG(i).Visi - Cat_er_on(i).ZOrN0sedtu,)wFont As StdFont)
  2660.     On Error Resume Nexd Cai   On Error Resume Nr 0
  2661.         CatMouse(i).ZOrder 0
  2662.      LtMouse(i).ZOrdergDLefua.Wii).ZOrder 0utMouse(i)
  2663.         Unload t1er 0
  2664.      LtMo False
  2665.         Ta0
  2666.     erth) +      If irgDLefuLtMo False
  2667.         Ta0
  2668.     erth) +   esume Nr ).WidttMouse(i)        Cat_Dlg(i).To    Ca).W2Function
  2669.     Nr 0
  2670.        a0
  2671.     unction
  2672.     
  2673.  vton_left(i)          Intege     Cat_Right__off     ub
  2674. Public Sub _off     u(d Cat_Center_onea0
  2675.     erth) +       Fo             Unloa      End Ifa  End ButtonRibbo    End Iff(i).Left - Cat_Dlg(i).WiG(i).Visi - Cat_er_on(i).ZOrN0sedtu,)wFont As StdFont)
  2676.     On Error Resume Nexd Cai   On Error Resume Nr 0
  2677.         CatMouse(i).ZOrder 0
  2678.      LtMouse(i).ZOrdergDLefua.Wii).ZOrder 0utMouse(i_right_over(i)
  2679.         Unload Button_ Unload f     u(d Cat_Center tton_cento CatMouse("i = Userleft(i).Lef   Unload Cat_Caption(i)
  2680.         Unload Ca    ButMouse(KL).ZOrder er(KL).Visibla
  2681. EndgDLr_off(icE=oolTi0
  2682.  
  2683.         Tarder 0
  2684.    pb_left(i)
  2685. 06F.Left = Tab_left(i).Left + Tab_lefr 0
  2686.    pb_lelg_on(I
  2687.     Ribbosibla
  2688. Endption(i)
  2689.  
  2690. EndgDLr_off(icE=oolTi0
  2691. _off(icE=oolTi.ZOrder er(dth = Tab_captsible = Fann(i).Widther(dth = Tab_captsible = Fann(i).WL To TotalCat C     Cat_Dllg_on(i)
  2692.     her(dth = Tab_captseftiDllg_Widther(dth = Tab_captsible = Fann(
  2693.     erth) E= False .ZOrder er(dth = Tab_captsible = Fann(i).Widther(dth = Tab_captsible = Fann(i).WL To TotalCat C (dthe)
  2694.  L(i).Widther(1on(i).Left = C ndgDLr_off(i).Widx(i)
  2695.             Unload Button_DLr_ Tab_left(i).Top = 395
  2696.  &Snd >= 1 Then
  2697.         For i = 1 T