Announcement

Collapse
No announcement yet.

Menu State Change????

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

  • Menu State Change????

    I can't get MENU SET STATE to function here is the code


    MENU SET STATE hPopup1, 1, %MF_GRAYED
    MENU SET STATE hPopup1, 2, %MF_ENABLED
    MENU SET STATE hPopup1, 3, %MF_GRAYED
    MENU DRAW BAR hDlg

    Please help!!

    ------------------
    DeeDee

  • #2
    MENU SET STATE is unfortunately broken... Until the next update becomes available, you can use the EnableMenuItem() API instead.

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

    Comment


    • #3
      Originally posted by Lance Edmonds:
      MENU SET STATE is unfortunately broken... Until the next update becomes available, you can use the EnableMenuItem() API instead.


      Ok, How do I get EnableMenuItem() API



      ------------------
      DeeDee

      Comment


      • #4
        I take it you have not downloaded and installed WIN32.HLP? (8Mb download from http://www.powerbasic.com/files/pub/mstools/win32.zip )

        Anyway, to use EnableMenuItem(), you'll need to #INCLUDE "WIN32API.INC" into your app, then the API syntax is thus:
        Code:
        Result& = EnableMenuItem(hMenu&, MenuItem&, MenuItemFlags&)
        where:
        Code:
        hMenu&         = the menu handle
        MenuItem&      = the item's ID number
        MenuItemFlags& = the desired menu item state (%MF_GRAYED, etc).
        Result&        = the previous state, if the API call was successful or 
                         -1 if an error occurred
        I hope this helps!


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

        Comment


        • #5
          C'mon Lance, if you're gonna go that far to help someone with an acknowledged "broken" (amazing how that other "b" word remains a four-letter word) function, why not take the bus to the end of the line?

          MenuItem& = the item's ID number
          MenuItemFlags& = the desired menu item state (%MF_GRAYED, etc).
          MenuItemFlags& may be written 'syntactically' as:

          Code:
          MenuItemFlags& = ({%MF_BYPOSITION | %MF_BYCOMMAND}) OR ({%MF_GRAYED|%MF_ENABLED|%MF_DISABLED})

          When MenuItemFlags includes %MF_BYPOSITION, Menuitem& is the zero-based index of the item on the menu to affect.
          When MenuItemFlags includes %MF_BYCOMMAND, MenuItem& is the "control id" associated with the menu item.

          MCM


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

          Comment

          Working...
          X