Sign in to follow this  
Followers 0
DjDeep00

Get Text from Selected Menuitems

3 posts in this topic

I am trying to read the selected menuitems. Here is my code...

;Favorites-Menu

$FavMenu = GUICtrlCreateMenu('F&avorites')

$ViewFavMenu = _GUICtrlCreateODMenuItem('Add To Favorites', $FavMenu, 'shell32.dll', 126)

$Favorites = _GUICtrlCreateODMenu('Favorites', $FavMenu, 'shell32.dll', 43)

$var = IniReadSection($INI_FILE, "Favorites")

If @error Then

Else

For $i = 1 To $var[0][0]

;MsgBox(4096, "", "Key: " & $var[$i][0] & @CRLF & "Value: " & $var[$i][1])

Global $item=_GUICtrlCreateODMenuItem($var[$i][0], $Favorites, 'shell32.dll', 43)

Next

EndIf

When I select the menuitem, I can get anything by using Guictrlread or even the advanced option. Basically I want to get what the user selected in the menu and then get that value for that name from the ini file.

Please help.

Share this post


Link to post
Share on other sites




[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Kool...One more question...How would I clear out some Menuitems and replace them with new ones. Should I tried using GUICTRLDELETE($Menuitem) but after I created the new ones, I stopped getting $msg from the parent menu for that menu item. Here is the code:

;Favorites-Menu

Global $FavMenu = GUICtrlCreateMenu('F&avorites')

_AddCtrl($FavMenu,"FavMenu")

Global $ViewFavMenu = _GUICtrlCreateODMenuItem('Add To Favorites', $FavMenu, 'shell32.dll', 126)

_AddCtrl($ViewFavMenu,"ViewFavMenu")

Global $Favorites = _GUICtrlCreateODMenu('Favorites', $FavMenu, 'shell32.dll', 43)

_AddCtrl($Favorites,"Favorites")

$var = IniReadSection($INI_FILE, "Favorites")

Dim $item[50]

If @error Then

Else

For $i = 1 To $var[0][0]

$item[$i]=_GUICtrlCreateODMenuItem($var[$i][0], $Favorites, 'shell32.dll', 43)

_AddCtrl($item[$i],$var[$i][0])

;MsgBox(4096,$i,$item[$i])

Next

Global $Fav_Count=$i

EndIf

;;;;Here is where I delete and recreate them:

GUICtrlDelete($Favorites)

$Favorites = _GUICtrlCreateODMenu('Favorites', $FavMenu, 'shell32.dll', 43)

_AddCtrl($Favorites,"Favorites")

GUISetState()

If @error Then

Else

$var = IniReadSection($INI_FILE, "Favorites")

Dim $item[50]

For $i = 1 To $var[0][0]

$item[$i]=_GUICtrlCreateODMenuItem($var[$i][0], $Favorites, 'shell32.dll', 43)

_AddCtrl($item[$i],$var[$i][0])

Next

;;For some reason Case $msg = $ViewFavMenu stops working in my while loop. Please Help.

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