home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD152462202001.psc / CoolMenu / frmTest.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-02-20  |  14.9 KB  |  408 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
  3. Begin VB.Form frmTest 
  4.    AutoRedraw      =   -1  'True
  5.    Caption         =   "Test form"
  6.    ClientHeight    =   4380
  7.    ClientLeft      =   165
  8.    ClientTop       =   450
  9.    ClientWidth     =   6300
  10.    BeginProperty Font 
  11.       Name            =   "Tahoma"
  12.       Size            =   8.25
  13.       Charset         =   0
  14.       Weight          =   400
  15.       Underline       =   0   'False
  16.       Italic          =   0   'False
  17.       Strikethrough   =   0   'False
  18.    EndProperty
  19.    ForeColor       =   &H00000080&
  20.    Icon            =   "frmTest.frx":0000
  21.    LinkTopic       =   "Form1"
  22.    ScaleHeight     =   292
  23.    ScaleMode       =   3  'Pixel
  24.    ScaleWidth      =   420
  25.    StartUpPosition =   1  'CenterOwner
  26.    Begin MSComctlLib.ImageList ImageList 
  27.       Left            =   3840
  28.       Top             =   0
  29.       _ExtentX        =   1005
  30.       _ExtentY        =   1005
  31.       BackColor       =   -2147483643
  32.       ImageWidth      =   16
  33.       ImageHeight     =   16
  34.       MaskColor       =   12632256
  35.       _Version        =   393216
  36.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  37.          NumListImages   =   11
  38.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  39.             Picture         =   "frmTest.frx":030A
  40.             Key             =   ""
  41.             Object.Tag             =   "&New"
  42.          EndProperty
  43.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  44.             Picture         =   "frmTest.frx":0466
  45.             Key             =   ""
  46.          EndProperty
  47.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  48.             Picture         =   "frmTest.frx":05C2
  49.             Key             =   ""
  50.             Object.Tag             =   "Sub&1"
  51.          EndProperty
  52.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  53.             Picture         =   "frmTest.frx":071E
  54.             Key             =   ""
  55.             Object.Tag             =   "Sub&2"
  56.          EndProperty
  57.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  58.             Picture         =   "frmTest.frx":087A
  59.             Key             =   ""
  60.             Object.Tag             =   "&Open"
  61.          EndProperty
  62.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  63.             Picture         =   "frmTest.frx":09D6
  64.             Key             =   ""
  65.             Object.Tag             =   "&Save"
  66.          EndProperty
  67.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  68.             Picture         =   "frmTest.frx":0B32
  69.             Key             =   ""
  70.             Object.Tag             =   "&Copy"
  71.          EndProperty
  72.          BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  73.             Picture         =   "frmTest.frx":0C8E
  74.             Key             =   ""
  75.             Object.Tag             =   "&Cut"
  76.          EndProperty
  77.          BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  78.             Picture         =   "frmTest.frx":0DEA
  79.             Key             =   ""
  80.             Object.Tag             =   "&Paste"
  81.          EndProperty
  82.          BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  83.             Picture         =   "frmTest.frx":0F46
  84.             Key             =   ""
  85.             Object.Tag             =   "&Quit"
  86.          EndProperty
  87.          BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  88.             Picture         =   "frmTest.frx":10A2
  89.             Key             =   ""
  90.             Object.Tag             =   "Sub&3"
  91.          EndProperty
  92.       EndProperty
  93.    End
  94.    Begin MSComctlLib.StatusBar StatusBar 
  95.       Align           =   2  'Align Bottom
  96.       Height          =   315
  97.       Left            =   0
  98.       TabIndex        =   0
  99.       Top             =   4065
  100.       Width           =   6300
  101.       _ExtentX        =   11113
  102.       _ExtentY        =   556
  103.       _Version        =   393216
  104.       BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
  105.          NumPanels       =   1
  106.          BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  107.             AutoSize        =   1
  108.             Object.Width           =   10610
  109.             Text            =   "Menu help text ( kMain )"
  110.             TextSave        =   "Menu help text ( kMain )"
  111.             Key             =   "kMain"
  112.          EndProperty
  113.       EndProperty
  114.    End
  115.    Begin VB.Menu mnuFile 
  116.       Caption         =   "&File"
  117.       Begin VB.Menu mnuNew 
  118.          Caption         =   "|Creates a new file|&New"
  119.          Shortcut        =   ^N
  120.       End
  121.       Begin VB.Menu mnuOpen 
  122.          Caption         =   "|Open an existing file|&Open ..."
  123.          Shortcut        =   ^O
  124.       End
  125.       Begin VB.Menu mnuSave 
  126.          Caption         =   "|Save the current file|&Save"
  127.          Enabled         =   0   'False
  128.          Shortcut        =   ^S
  129.       End
  130.       Begin VB.Menu mnuSaveas 
  131.          Caption         =   "|Save the current file|Save &as..."
  132.          Enabled         =   0   'False
  133.       End
  134.       Begin VB.Menu mnuLine11 
  135.          Caption         =   "-"
  136.       End
  137.       Begin VB.Menu mnuQuit 
  138.          Caption         =   "|Quit the application|&Quit"
  139.          Shortcut        =   ^Q
  140.       End
  141.    End
  142.    Begin VB.Menu mnuEdit 
  143.       Caption         =   "&Edit"
  144.       Begin VB.Menu mnuCut 
  145.          Caption         =   "|Cut selected object|&Cut"
  146.          Shortcut        =   ^X
  147.       End
  148.       Begin VB.Menu mnuCopy 
  149.          Caption         =   "|Copy selected object|&Copy"
  150.          Shortcut        =   ^C
  151.       End
  152.       Begin VB.Menu mnuPaste 
  153.          Caption         =   "|Paste an object from the clipboard|&Paste"
  154.          Enabled         =   0   'False
  155.          Shortcut        =   ^V
  156.       End
  157.    End
  158.    Begin VB.Menu mnuOption 
  159.       Caption         =   "&Test"
  160.       Begin VB.Menu mnuBitmap 
  161.          Caption         =   "!"
  162.       End
  163.       Begin VB.Menu mnuEmbossedColor 
  164.          Caption         =   "#|Draws disabled images in color|&Embossed in color"
  165.          Shortcut        =   ^E
  166.       End
  167.       Begin VB.Menu mnuComplexChecks 
  168.          Caption         =   "#|Draws complex checks boxes and radio buttons|&Complex checks"
  169.          Shortcut        =   ^K
  170.       End
  171.       Begin VB.Menu mnuFullSelect 
  172.          Caption         =   "#|Draws a full selection bar|&Full selection"
  173.          Shortcut        =   ^F
  174.       End
  175.       Begin VB.Menu mnuRightToLeft 
  176.          Caption         =   "#|Draws text from right to left|&Right to left"
  177.          Shortcut        =   ^R
  178.       End
  179.       Begin VB.Menu mnuLine3 
  180.          Caption         =   "-Color selection"
  181.       End
  182.       Begin VB.Menu mnuColor 
  183.          Caption         =   "*|Set the color to red|&Red"
  184.          Index           =   0
  185.          Shortcut        =   {F1}
  186.       End
  187.       Begin VB.Menu mnuColor 
  188.          Caption         =   "*|Set the color to green|&Green"
  189.          Index           =   1
  190.          Shortcut        =   {F2}
  191.       End
  192.       Begin VB.Menu mnuColor 
  193.          Caption         =   "*|Set the color to blue|&Blue"
  194.          Index           =   2
  195.          Shortcut        =   {F3}
  196.       End
  197.       Begin VB.Menu mnuLine31 
  198.          Caption         =   "-Apply color..."
  199.       End
  200.       Begin VB.Menu mnuColorSel 
  201.          Caption         =   "*|Will apply the next selected color to the menu font|... to menu caption"
  202.          Checked         =   -1  'True
  203.          Index           =   0
  204.       End
  205.       Begin VB.Menu mnuColorSel 
  206.          Caption         =   "*|Will apply the next selected color to the menu selection|... to menu selection"
  207.          Index           =   1
  208.       End
  209.       Begin VB.Menu mnuLine4 
  210.          Caption         =   "-Sub Menu"
  211.       End
  212.       Begin VB.Menu mnuSub 
  213.          Caption         =   "|This is the option submenu|&Options"
  214.          Begin VB.Menu mnuSub1 
  215.             Caption         =   "|This is example ""Sub1""|Sub&1"
  216.          End
  217.          Begin VB.Menu mnuSub2 
  218.             Caption         =   "|This is example ""Sub2""|Sub&2"
  219.             Enabled         =   0   'False
  220.          End
  221.          Begin VB.Menu mnuLine2 
  222.             Caption         =   "-More Checks"
  223.          End
  224.          Begin VB.Menu mnuSub3 
  225.             Caption         =   "|This is example ""Sub3""|Sub&3"
  226.             Checked         =   -1  'True
  227.          End
  228.          Begin VB.Menu mnuSub4 
  229.             Caption         =   "#|This is example ""Sub4""|Sub&4"
  230.             Checked         =   -1  'True
  231.             Enabled         =   0   'False
  232.          End
  233.          Begin VB.Menu mnuSub5 
  234.             Caption         =   "*|This is example ""Sub5""|Sub&5"
  235.             Checked         =   -1  'True
  236.             Enabled         =   0   'False
  237.          End
  238.       End
  239.       Begin VB.Menu mnuCheckTest 
  240.          Caption         =   "|This is a dummy check submenu|&Check demo"
  241.          Begin VB.Menu mnuCheckDemo 
  242.             Caption         =   "#|Empty check|Empty check"
  243.             Index           =   0
  244.          End
  245.          Begin VB.Menu mnuCheckDemo 
  246.             Caption         =   "#|Checked check|Checked check"
  247.             Checked         =   -1  'True
  248.             Index           =   1
  249.          End
  250.          Begin VB.Menu mnuCheckDemo 
  251.             Caption         =   "#|Disabled check|Disabled check"
  252.             Enabled         =   0   'False
  253.             Index           =   2
  254.          End
  255.          Begin VB.Menu mnuCheckDemo 
  256.             Caption         =   "#|2e disabled check|2e disabled check"
  257.             Checked         =   -1  'True
  258.             Enabled         =   0   'False
  259.             Index           =   3
  260.          End
  261.       End
  262.       Begin VB.Menu mnuRadioTest 
  263.          Caption         =   "|This is a dummy radio submenu|&Radio demo"
  264.          Begin VB.Menu mnuRadioDemo 
  265.             Caption         =   "*|Empty radio|Empty radio"
  266.             Index           =   0
  267.          End
  268.          Begin VB.Menu mnuRadioDemo 
  269.             Caption         =   "*|Selected radio|Selected radio"
  270.             Checked         =   -1  'True
  271.             Index           =   1
  272.          End
  273.          Begin VB.Menu mnuRadioDemo 
  274.             Caption         =   "*|Disabled radio|Disabled radio"
  275.             Enabled         =   0   'False
  276.             Index           =   2
  277.          End
  278.          Begin VB.Menu mnuRadioDemo 
  279.             Caption         =   "*|2e disabled radio|2e disabled radio"
  280.             Checked         =   -1  'True
  281.             Enabled         =   0   'False
  282.             Index           =   3
  283.          End
  284.       End
  285.    End
  286. Attribute VB_Name = "frmTest"
  287. Attribute VB_GlobalNameSpace = False
  288. Attribute VB_Creatable = False
  289. Attribute VB_PredeclaredId = True
  290. Attribute VB_Exposed = False
  291. '''''''''''''''''''''''''''''''''''''''''''''''''''''
  292. '''''''''''''''''''''''''''''''''''''''''''''''''''''
  293. ''  frmTest Form
  294. ''  Copyright Olivier Martin 2000
  295. ''  martin.olivier@bigfoot.com
  296. ''  This form tests CoolMenu's functionality
  297. '''''''''''''''''''''''''''''''''''''''''''''''''''''
  298. '''''''''''''''''''''''''''''''''''''''''''''''''''''
  299. Option Explicit
  300. Private WithEvents HelpObj As HelpCallBack
  301. Attribute HelpObj.VB_VarHelpID = -1
  302. Private Sub Form_Load()
  303.   Set HelpObj = New HelpCallBack
  304.   Set objCoolMenu = New cCoolMenu
  305.   Call objCoolMenu.Install(Me.hWnd, HelpObj, ImageList)
  306. ''Any property function must be used AFTER the
  307. ''installation statement above
  308. ''If the FontName property is nothing,
  309. ''CoolMenu uses the form's text style and size
  310. ''If you set FontName to something, default size
  311. ''and color will be used.
  312. ''Setting size without FontName as no effect
  313. '  Call FontName(Me.hWnd, "Tahoma")
  314. '  Call FontSize(Me.hWnd, 8)
  315. '  Call ForeColor(Me.hWnd, &H80)
  316. ''This is yet to be resolved: bright colors on
  317. ''selection bar should print menu text in dark color;
  318. ''any ideas ?
  319. '  Call SelectColor(Me.hWnd, vbWhite)
  320.   mnuColor(0).Checked = True
  321.   mnuColorSel(0).Checked = True
  322.   mnuComplexChecks.Checked = objCoolMenu.ComplexChecks(Me.hWnd)
  323.   mnuComplexChecks.Checked = objCoolMenu.ComplexChecks(Me.hWnd)
  324.   mnuEmbossedColor.Checked = objCoolMenu.ColorEmbossed(Me.hWnd)
  325.   mnuFullSelect.Checked = objCoolMenu.FullSelect(Me.hWnd)
  326.   'Set the Right to Left property of CoolMenu to the value
  327.   'of the form's.  This wasn't fully tested on my system;
  328.   'I'm waiting feedback from
  329.   Call objCoolMenu.RightToLeft(Me.hWnd, Me.RightToLeft)
  330.   mnuRightToLeft.Checked = objCoolMenu.RightToLeft(Me.hWnd)
  331.   StatusBar.Panels("kMain").Text = ""
  332. End Sub
  333. Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  334.   If Button = 2 Then
  335.     Me.PopupMenu mnuEdit, 0, x, y
  336.   End If
  337. End Sub
  338. Private Sub Form_Unload(Cancel As Integer)
  339.   Call objCoolMenu.Uninstall(Me.hWnd)
  340.   Set HelpObj = Nothing
  341. End Sub
  342. Private Sub HelpObj_MenuHelp(ByVal MenuText As String, ByVal MenuHelp As String, ByVal Enabled As Boolean)
  343.   If Enabled Then
  344.     StatusBar.Panels("kMain").Text = MenuHelp$
  345.   Else
  346.     StatusBar.Panels("kMain").Text = ""
  347.   End If
  348. End Sub
  349. Private Sub mnuCopy_Click()
  350.   mnuPaste.Enabled = True
  351.   mnuCopy.Enabled = False
  352.   mnuCut.Enabled = False
  353. End Sub
  354. Private Sub mnuCut_Click()
  355.   mnuPaste.Enabled = True
  356.   mnuCopy.Enabled = False
  357.   mnuCut.Enabled = False
  358. End Sub
  359. Private Sub mnuPaste_Click()
  360.   mnuPaste.Enabled = False
  361.   mnuCopy.Enabled = True
  362.   mnuCut.Enabled = True
  363. End Sub
  364. Private Sub mnuEmbossedColor_Click()
  365.   mnuEmbossedColor.Checked = Not mnuEmbossedColor.Checked
  366.   Call objCoolMenu.ColorEmbossed(Me.hWnd, mnuEmbossedColor.Checked)
  367. End Sub
  368. Private Sub mnuFullSelect_Click()
  369.   mnuFullSelect.Checked = Not mnuFullSelect.Checked
  370.   Call objCoolMenu.FullSelect(Me.hWnd, mnuFullSelect.Checked)
  371. End Sub
  372. Private Sub mnuComplexChecks_Click()
  373.   mnuComplexChecks.Checked = Not mnuComplexChecks.Checked
  374.   Call objCoolMenu.ComplexChecks(Me.hWnd, mnuComplexChecks.Checked)
  375. End Sub
  376. Private Sub mnuQuit_Click()
  377.   Unload Me
  378. End Sub
  379. Private Sub mnuColor_Click(Index As Integer)
  380.   On Error Resume Next
  381.   Dim i As Integer
  382.   For i = 0 To 2
  383.     mnuColor(i).Checked = (i = Index)
  384.   Next i
  385.   Dim Color As Long
  386.   Color = CLng("&H80" + String(Index * 2, "0"))
  387.   If mnuColorSel(0).Checked Then _
  388.     Call objCoolMenu.ForeColor(Me.hWnd, Color&)
  389.   If mnuColorSel(1).Checked Then _
  390.     Call objCoolMenu.SelectColor(Me.hWnd, Color&)
  391. End Sub
  392. Private Sub mnuColorSel_Click(Index As Integer)
  393.   Dim i As Integer
  394.   For i = 0 To 1
  395.     mnuColorSel(i).Checked = (i = Index)
  396.   Next i
  397. End Sub
  398. Private Sub mnuRightToLeft_Click()
  399.   mnuRightToLeft.Checked = Not mnuRightToLeft.Checked
  400.   Call objCoolMenu.RightToLeft(Me.hWnd, mnuRightToLeft.Checked)
  401. End Sub
  402. Private Sub mnuSub3_Click()
  403.   mnuSub3.Checked = Not mnuSub3.Checked
  404. End Sub
  405. Private Sub mnuSub4_Click()
  406.   mnuSub4.Checked = Not mnuSub4.Checked
  407. End Sub
  408.