Jump to content
Sign in to follow this  
JWoodruff

Getting the text value of a menu item

Recommended Posts

???

#include <GUIConstants.au3>

GUICreate("")
$SelectList = GUICtrlCreateList("", 48, 88, 121, 77, -1, 0)
GUICtrlSetData(-1, "1. Auto Fighter|2. Power Cutter|3. Power Fisher|4. Power Miner")
GUISetState()

While 1
    
    $msg = GUIGetMsg()
    
    If $msg = $SelectList Then MsgBox(0x0, "test", GUICtrlRead($SelectList), 2)
    
    If $msg = -3 Then Exit
    
WEnd

8)

Share this post


Link to post
Share on other sites

Hello Again,

Ok I have created dynamic menu items that are read from an ini.

problem now is that when they are clicked I need the text value of that item in order to continue. Is there an easy way to get that value? I have attempted using GUICtrlRead(menucontrolvalue) no luck.

Thanks

Don't know how to read the text, though I'm sure it's possible. But if you don't get a solution then if you are creating the menus from an ini file then you must be using the text when you generate the menu, so could you just save that in an array with the menu item ids?

$Mi[$n][0] = GuiCtrlCreateMenuItem($text,...

$Mi[$n][1] = $text


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Don't know how to read the text, though I'm sure it's possible. But if you don't get a solution then if you are creating the menus from an ini file then you must be using the text when you generate the menu, so could you just save that in an array with the menu item ids?

$Mi[$n][0] = GuiCtrlCreateMenuItem($text,...

$Mi[$n][1] = $text

Thanks Martin! Looks like that's the way to go.

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  

×
×
  • Create New...