Announcement

Collapse
No announcement yet.

Menues

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

  • Menues

    I have no problem with popup menues but I can't figure out how to create a menu item (MainMenu?) that could be used as a button (a menu item without a popup).
    It means that, upon being clicked at, this menu item could invoke the associated action.

    Any help in this regard will highly be appreciated,

    Edmund


    [email protected]

  • #2
    I'm old fashioned, I still do mine in the resource file and then load them, although the prospect of creating and deleting menu's is awesome, just haven't had a need.

    But if this helps, this is an RC file from my Winlog for Windows 2000 product.

    Code:
    //* FILE
    #define IDM_CLEAR             WM_USER       + 2048    // Clear Log
    #define IDM_PRINT             IDM_CLEAR     + 1       // Print
    #define IDM_SAVEAS            IDM_PRINT     + 1       // SaveAs
    #define IDM_EXIT              IDM_SAVEAS    + 1       // Exit
    
    //* EDIT
    #define IDM_COPY              IDM_EXIT       + 1       // Copy
    
    //* VIEW
    #define IDM_STATUS            IDM_COPY       + 1      //VIEW STATUS
    #define IDM_LOGFILE	      IDM_STATUS     + 1
    #define IDM_BADPASS	      IDM_LOGFILE     + 1      //VIEW BAD PASS ATTEMPTS
    #define IDM_OPTIONS           IDM_BADPASS    + 1      //OPTIONS
    //* HELP
    #define IDM_HELP              IDM_OPTIONS      + 1       // Help
    #define IDM_ABOUT             IDM_HELP      + 1       // About box
    
    '
    '
    
    STRINGTABLE LOADONCALL MOVEABLE
      BEGIN
        IDM_CLEAR,      "Clear Log File (Deletes file)"
        IDM_PRINT,      "Print Log File"
        IDM_SAVEAS,     "Save Log File As Text"
        IDM_EXIT,       "Exit Winlog 98/NT"
        IDM_COPY,       "Copy to clipboard"
        IDM_LOGFILE     "View Log File"
        IDM_BADPASS,    "View Failed Login Attempts"
        IDM_STATUS,     "Shows or hides the Status Bar"
        IDM_OPTIONS,    "Winlog Options"
        IDM_HELP,       "Help Me!!"
        IDM_ABOUT,      "About WinLog 98/NT"
      END
    
    MAINMENU MENU LOADONCALL MOVEABLE
      BEGIN
        POPUP "&File"
          BEGIN
            MENUITEM "&Clear Log",                   IDM_CLEAR
            MENUITEM "&Print",                       IDM_PRINT
            MENUITEM "Save &As",                     IDM_SAVEAS
            MENUITEM "E&xit",                        IDM_EXIT
          END
        POPUP "&Edit"
          BEGIN
            MENUITEM "&Copy Log to Clipboard",        IDM_COPY
          END
        POPUP "&View"
          BEGIN
            MENUITEM "&Status Bar"                    IDM_STATUS
            MENUITEM "&Log File"			  IDM_LOGFILE
            MENUITEM "&Failed Logins"		  IDM_BADPASS
            MENUITEM "&Options"                       IDM_OPTIONS
          END
        POPUP "&Help", HELP
          BEGIN
            MENUITEM "&Help",                         IDM_HELP
            MENUITEM "&About",                        IDM_ABOUT
          END
      END

    ------------------
    Scott
    mailto:[email protected][email protected]</A>
    MCSE, MCP+Internet
    Scott Turchin
    MCSE, MCP+I
    http://www.tngbbs.com
    ----------------------
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

    Comment


    • #3
      If you give the menu item the same ID as the button, the two will
      invoke the same associated action. Like:
      Code:
      CONTROL ADD BUTTON, hDlg, %IDCANCEL, "E&xit", 50, 50, 40, 14
       
      MENU NEW BAR TO hMnu
      MENU NEW POPUP TO hMnuFile
      MENU ADD STRING,  hMnuFile, "E&xit here too", %IDCANCEL, %MF_ENABLED
      MENU ATTACH hMnu, hDlg
      ------------------



      [This message has been edited by Borje Hagsten (edited June 17, 2000).]

      Comment


      • #4
        Thank you very much Scott and Borje for your tips on creation of menus without popups.
        Since I am using DDTs I have implemented your tip, Borje, and, of course, it works.

        Thanks again,


        Edmund

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

        Comment

        Working...
        X