Results 1 to 5 of 5

Thread: toolbar

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2001
    Location
    Massachusetts, USA
    Posts
    111

    Question

    hello i am just beginning to program with visual basic. i added a toolbar control to my form. added a drop down style button to work. i was wondering how to code the menu for the drop down menu........without using form.popupmenu.

  2. #2
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    ok you can goto my site and download the source for Writer2 its called writer2Source.zip. ok but ill tell you here also


    double click the toolbar in the sub type
    Code:
    select case button.key
    
    case "name of key"
    code
    
    case "name of key2"
    code
    
    case "name of key3"
    code
    
    end select
    you have to put the keys where they belong name of key 1,2,3 are the name of the keys that belong to the button.
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  3. #3
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    736
    Try using buttonMenuClick. It looks like you can only have one drop down button per toolbar though.
    Code:
    Private Sub Toolbar1_ButtonMenuClick(ByVal ButtonMenu As MSComctlLib.ButtonMenu)
        Select Case ButtonMenu.Index
            Case 1
                MsgBox "button 1 clicked"
            Case 2
                MsgBox "button 2 clicked"
        End Select
    End Sub

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Mar 2001
    Location
    Massachusetts, USA
    Posts
    111
    here is what i have so far....i have the menu coming up ....all i need now i to have a click event for each menu item........


    Private Sub Toolbar1_ButtonClick(ByVal button As MSComctlLib.button)
    'code to execute main button click
    End Sub

    Private Sub Toolbar1_ButtonDropDown(ByVal button As MSComctlLib.button)
    'code to make a menu for the drop down portion of the button
    button.ButtonMenus.Clear
    button.ButtonMenus.Add.Text = "menu item 1"
    button.ButtonMenus.Add.Text = "menu item 2"
    End Sub

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Mar 2001
    Location
    Massachusetts, USA
    Posts
    111
    I got it.....i cant believe it took me so long.....thanks for the help.



    Private Sub Toolbar1_ButtonClick(ByVal button As MSComctlLib.button)
    'code to execute main button click

    End Sub

    Private Sub Toolbar1_ButtonDropDown(ByVal button As MSComctlLib.button)
    'code to make a menu for the drop down portion of the button
    button.ButtonMenus.Clear
    button.ButtonMenus.Add.Text = "menu item 1"
    button.ButtonMenus.Add.Text = "menu item 2"

    End Sub

    Private Sub Toolbar1_ButtonMenuClick(ByVal ButtonMenu As MSComctlLib.ButtonMenu)
    'code for clicking on the different items of the menu
    x = Right(ButtonMenu.Text, 1)
    Select Case x
    Case 1
    MsgBox 1
    Case 2
    MsgBox 2
    Case Else
    MsgBox "somethings wrong"
    End Select
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width