Jump to content

How to change the text of a menu item?


CatchFish
 Share

Recommended Posts

I need to change the text of a menu item dynamically. But I can't do it with GUICtrlSetData().;) [v3.1.1.80]

It's possible to change the text by deleting and rebuilding the menu item. But the problem is I need to write much more code to sort the menu items. Is it a better idea changing it directly with GUICtrlSendMsg()? Can anybody show me the code?

Link to comment
Share on other sites

@Catchfish: where do you have the problem?

Here it works normally (XPSP2):

#include <GUIConstants.au3>

GUICreate("Test")

$menu = GUICtrlCreateMenu ("&File")
$item = GUICtrlCreateMenuitem ("Open",$menu)

$button = GUICtrlCreateButton ("Check",50,130,70,20)

GUISetState ()
While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $button
            GUICtrlSetData($menu, "&Files")
            GUICtrlSetData($item, "Openup")
    EndSwitch
WEnd

GUIDelete()

Exit

Regards

Holger

Link to comment
Share on other sites

Well, I have to recognize that your code works in v3.1.1.81...But I was scripting with v3.1.1.80 when I posted that topic. Same problem in v3.1.1 public release.

Most important, everything's okay now...with the help of the new beta release.

Thanks, Holger.

Edited by CatchFish
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...