Sign in to follow this  
Followers 0
CatchFish

How to change the text of a menu item?

4 posts in this topic

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?

Share this post


Link to post
Share on other sites



Thanks a lot, Larry. I'll check it.

I still wonder if the GUI menu created by GUICtrlCreateMenuItem() can be handled in the same way...

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0