Announcement

Collapse
No announcement yet.

How to drop-down pop-up menus?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to drop-down pop-up menus?

    Does anyone know of a method whereby a dropdown (pop-up) menu - as well as dropdown submenus -- may be activated (dropped down and highlighted)
    programatically, i.e., without using of mouse or keyboard?

    Any info will be greatly appreciated.



    ------------------

  • #2
    Do you want to highlight a menu item programmatically, or just launch the menu? For the latter, check out TrackPopupMenu().


    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      Lance, I am referring to the menu bar along the top (Files, Edit, Help
      etc.). In my app I have (so far) only three items, and the second is
      simply called Menus, with M as accelerator. When Menu is selected by mouse click or accelerator, a menu drops down. All these first items have sub-menus (i.e., the arrowhead on the right end).

      These submenus have some items with further sub-menus, and so on down
      to a fourth level (at present).

      What I want to do is, when one selects an item (say on the fourth
      level) then, when the task has been finished and the user returns to
      the initial screen, to redisplay the menus in the form that they were
      at the moment when the task was selected, with the same trail of
      highlighted menu items as was the case was the job was ready to be
      selected.

      In the DOS version of this package that is the case, and it is
      convenient for someone who deals only with (say) Debtors, to come back
      to that menu/submenu without having to click their way from scratch
      every time. I know Windows does't do it this way, but even though it is
      an operating system rather than an application, it can be irritating
      at times.

      ------------------

      Comment


      • #4
        Just looking at the WinAPI "menu" help, it looks like you could intercept the WM_MENUSELECT messages, keep track of the values, and then later when the user has finished his task, recreate the sequence to get back to the same menu.

        Alternately, you could eschew the use of menus, and layer modal dialog boxes which "look" like menus.

        MCM

        Michael Mattias
        Tal Systems Inc. (retired)
        Racine WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          Ugh!

          Reopening a menu item is a complete deviation from standard GUI interface behavior. I've never seen a GUI application that offers the kind of menu behavior you want.

          Besides, if the app did not have focus after the 'previous' event was processed, then the menu would not be able to be displayed anyway (because that app would not own the foreground).

          The "correct" way would be to add a toolbar so that the desired functionality is available at the click of a button, rather than by reopening a "deep" menu in a non-standard manner.

          My $0.02...

          ------------------
          Lance
          PowerBASIC Support
          mailto:[email protected][email protected]</A>
          Lance
          mailto:[email protected]

          Comment


          • #6
            We have all along, since the DOS version was started, rated user-
            friendlyness a high priority. This is not a major point, but
            it makes a difference, such as in the example I quote above.
            Our main aim is to have the package perform what is is designed for
            with minimum effort. If Windows does not work that way in a respect
            such as this, we have to improve on it.

            Michael, you get my message, I do want to "recreate the sequence to
            get back to the same menu" -- my question is HOW? I do use the
            WM_MENUSELECT messages, in the first place to access the task selected,
            but noting the "trail" at the same time. When it gets back, however,
            I can't find a way to reset the menus to the previous position. No
            "MENUITEM_CLICK" or "MENU_DROPDOWN" anywhere! Are there functions/subs
            to get the menu to drop down, select items, etc. from CODE?



            ------------------

            Comment


            • #7
              I have to ask: If you designed the menu structure, won't you already "know" where the menu item is?

              I'm sorry, but I don't fully subscribe to idea that "just because my DOS user interface worked this way, I have to emulate it in Windows". Why bother moving to Windows if it looks and behaves exactly the same? (not withstanding technical issues like native TCP, more memory, ODBC, etc)?

              While maintining some "legacy" design aspects is a nice idea, and may be central to the design of some specific applications, are you sure that your users will want a Windows program that does not act like a "normal" Windows program? Those coming from the DOS version may appreciate it, but those that start out with the Windows version may feel differently.

              For example, many programmers porting DOS code to Windows want the ENTER key to move to the next field on a 'form', as the TAB key does in a standard GUI window/dialog. This is done so existing users can use the software. Pity that they will find it works differently to almost all other Windows applications.

              Windows UI "purists" will hate this, as the ENTER key is designed to activate the default button, not move the caret to another control.

              Also, the modified behavior is at odds with entering text into a multiline edit control, requiring special care when handling the UI design.

              Afterall, customers who ask for a Windows version of a DOS product do so because the interface works in a "standard" way, it's behavior is predictable, and it "looks" nicer... why go against the grain?

              Anyway, this is just my humble opinion - you are totaly free to design your application UI as you see fit.

              (BTW, I wonder why you have not been swamped with example code to programmatically reopen a previously selected menu item...? <just kidding!> )

              ------------------
              Lance
              PowerBASIC Support
              mailto:[email protected][email protected]</A>
              Lance
              mailto:[email protected]

              Comment


              • #8
                Just had an idea...

                Since you know what the "last" menu was, you should be able to invoke that menu on return from processing with TrackPopupMenu.

                And (he asked), if this is a DOS to Windows conversion, why not restructure the menus/dialogs anyway? The user has a re-training period regardless.

                MCM


                Michael Mattias
                Tal Systems Inc. (retired)
                Racine WI USA
                [email protected]
                http://www.talsystems.com

                Comment


                • #9
                  Originally posted by DienyduToit:
                  What I want to do is, when one selects an item (say on the fourth
                  level) then, when the task has been finished and the user returns to
                  the initial screen, to redisplay the menus in the form that they were
                  at the moment when the task was selected, with the same trail of
                  highlighted menu items as was the case was the job was ready to be
                  selected.
                  Sounds to me like you could benefit from another GUI style.

                  Maybe something like: http://www.chami.com/html-kit/help/screen.html
                  HTML-Kit is free, so why not download and get some inspiration.



                  ------------------
                  Best Regards
                  Peter Scheutz
                  Best Regards
                  Peter Scheutz

                  Comment


                  • #10
                    Just to see if it was workable, I created a small test program, you can all download it here: http://www.kgpsoftware.com/downloads/slmenu.zip

                    Is that what you mean?

                    If so, then just one word... YUCK!!!

                    (email me for the source)

                    Regards,

                    ------------------
                    Kev G Peel
                    KGP Software, Bridgwater, UK.
                    mailto:[email protected][email protected]</A> http://www.kgpsoftware.com

                    [This message has been edited by Kev Peel (edited June 15, 2001).]
                    kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

                    Comment

                    Working...
                    X