Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

add elements to menu

MFHMFH Member Posts: 56
hi everybody
Is it possible to add (or delete) a part of the menu during the execution of the program? What I need is to have a "open recent file" menu, in which the user chooses how many recent files the program should display, and a "select language" menu, in which the number of languages possible depends on how many language files there are (so it is easier to modify or add a language).

thanks for the help

Comments

  • dokken2dokken2 Member Posts: 532
    : hi everybody
    : Is it possible to add (or delete) a part of the menu during the
    : execution of the program? What I need is to have a "open recent
    : file" menu, in which the user chooses how many recent files the
    : program should display, and a "select language" menu, in which the
    : number of languages possible depends on how many language files
    : there are (so it is easier to modify or add a language).
    :
    : thanks for the help


    there's probably a way to do this, but a simple a quick way would be to
    use the Visible property. create some generic menu items and first set the Visible property to False so they aren't shown. when you need them, set their Caption and Visible property - voila, they are 'added' to the menu

    Me.mnu1_1.Caption = "file 1"
    Me.mnu1_1.Visible = True

    Me.mnu1_2.Caption = "file 2"
    Me.mnu1_2.Visible = True

    Me.mnu1_3.Caption = "file 3"
    Me.mnu1_3.Visible = True
  • BitByBit_ThorBitByBit_Thor Member Posts: 2,444

    : there's probably a way to do this ...

    VB6 is not very flexible with it's menu's.
    I doubt it allows for dynamic creation - I'll check as soon as I get behind a computer with VB6 (might take a week though).

    Best Regards,
    Richard

    The way I see it... Well, it's all pretty blurry
  • MFHMFH Member Posts: 56
    @dokken2: I already thought at this possibility, but I can add just a limited amount of elements, if I want more of them I hare to recompile the program

    @BitByBit_Thor: no problem, I'm not in a hurry

    I think the problem can be reduced to: how can I place a new menu in a certain position? (this is all I've done till now...)
  • dokken2dokken2 Member Posts: 532
    : @dokken2: I already thought at this possibility, but I can add just
    : a limited amount of elements, if I want more of them I hare to
    : recompile the program
    :
    : @BitByBit_Thor: no problem, I'm not in a hurry
    :
    : I think the problem can be reduced to: how can I place a new menu in
    : a certain position? (this is all I've done till now...)


    vb6 does allow dynamic menu creation, see this link-
    http://articles.techrepublic.com.com/5100-3513-5030277.html


    the article doesn't mention this, but you can determine which added menu item was clicked from the Click events Index property-

    Private Sub mnuFilesList_Click(Index As Integer)
    MsgBox Index
    End Sub
  • MFHMFH Member Posts: 56
    : : @dokken2: I already thought at this possibility, but I can add just
    : : a limited amount of elements, if I want more of them I hare to
    : : recompile the program
    : :
    : : @BitByBit_Thor: no problem, I'm not in a hurry
    : :
    : : I think the problem can be reduced to: how can I place a new menu in
    : : a certain position? (this is all I've done till now...)
    :
    :
    : vb6 does allow dynamic menu creation, see this link-
    : http://articles.techrepublic.com.com/5100-3513-5030277.html
    :
    :
    : the article doesn't mention this, but you can determine which added
    : menu item was clicked from the Click events Index property-
    :
    : Private Sub mnuFilesList_Click(Index As Integer)
    : MsgBox Index
    : End Sub
    :
    well, it seems quite simple after all. many thanks for the help!
Sign In or Register to comment.