DjDeep00 Posted August 7, 2006 Share Posted August 7, 2006 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. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 7, 2006 Moderators Share Posted August 7, 2006 Look at eltorros menu options here:http://www.autoitscript.com/forum/index.ph...st&p=211035 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. Link to comment Share on other sites More sharing options...
DjDeep00 Posted August 9, 2006 Author Share Posted August 9, 2006 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now