Popup/context menus not showing in modal forms

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • diogenes

    Popup/context menus not showing in modal forms

    I have created many shortcut/popup (aka context, or right-click) menus for my
    application - instead of toolbars or standard drop-down menus.

    Within my custom menu, I am using =ShowMainMenu(" item") in the On Action
    event where ShowMainMenu is a public function in frmMain, and "item" is a
    string mapping to a button click event.

    (error trapping omitted)

    Public Function ShowMainMenu(st rItem As String) As Boolean

    Dim blnResult As Boolean

    Select Case strItem

    Case "firstItem"
    cmdFirst_Click
    Case "secondItem "
    cmdSecond_Click
    End Select

    ShowMainMenu = blnResult

    End Function

    (each form has a variation on this function)

    It appears that my menus work fine in forms that are not modal dialog
    windows, but the modal ones seem to block the communication between the menu
    and the form. I have a break set on the function, but it never trips.

    I have a few forms that are opened modally AND non-modally depending on the
    calling form. Modal = no workie.

    Is this a known limitation? Is there some sort of setting somwhere or VBA
    code I can write to work around this?



  • Albert D. Kallal

    #2
    Re: Popup/context menus not showing in modal forms


    It is entirely possible that you're confusing the issue between dialog
    forms, and what are known as model forms in MS access.

    Dialog forms do not allow the cursor/focus to use any of the custom or built
    in menus at all. The behavior is the same as if in code you displayed a
    msgbox command. Now how when using a msgbox command you can not use menus,
    or have the focus move to anything other than that actual form (or dialog
    box). This includes also the built in menus, or in your case custom menu
    bars, they simply cannot be used in any way shape or form when you use a
    dialog form. (or the msgbox command...you can even try this from the debug
    window, and type in:

    msgbox "hello"

    now, try and use the menus...you can not untill you hit ok.
    It appears that my menus work fine in forms that are not modal dialog
    windows
    modal disalog form??? Model forms, and dialog forms are VERY VERY much
    different animals.
    I have a few forms that are opened modally AND non-modally depending on
    the
    calling form. Modal = no workie.
    The above information is likely incorrect, since the openform command has NO
    way of setting a form as modal, or non model via the open command. You can
    certainly supply the acdialog parameter, and the form will open as dialog,
    but that is NOT the forms model setting, and is very much a differnt setting
    alltogher.

    If you want to open a form as model in code, then you have to go:

    dim strF as string

    strF = "name of my form goes here"

    docmd.OpenForm strF
    forms(strF).mod al = true
    >
    Is this a known limitation? Is there some sort of setting somwhere or VBA
    code I can write to work around this?
    Keep in mind the difference between modal, and dialog forms, I explain the
    difference here:



    are you use you need dialog forms, or will a modal form suffice?

    --
    Albert D. Kallal (Access MVP)
    Edmonton, Alberta Canada
    pleaseNOOSpamKa llal@msn.com



    Comment

    • diogenes

      #3
      Re: Popup/context menus not showing in modal forms

      "Albert D. Kallal" <PleaseNOOOsPAM mkallal@msn.com wrote in
      news:6jQRj.1007 07$rd2.81244@pd 7urf3no:
      >
      It is entirely possible that you're confusing the issue between dialog
      forms, and what are known as model forms in MS access.
      Yes, you nailed it. That's exactly what happened. I've been opening forms
      with acDialog, thinking that gives me a modal form. I may have never
      discovered it if I hadn't tried to implement custom menus. Doh!

      If you want to open a form as model in code, then you have to go:
      >
      dim strF as string
      >
      strF = "name of my form goes here"
      >
      docmd.OpenForm strF
      forms(strF).mod al = true
      So the second line is executed before the form opens?

      It appears that I can do Me.Modal = True in my Form_Open event. Is that
      equivalent?
      are you use you need dialog forms, or will a modal form suffice?
      Modal forms are exactly what I need, and I can now go and rewrite all my form
      opening code to do away with acDialog (except in the few cases I might need
      it). Thanks for the quick education!

      Comment

      Working...