Micoman Posted May 21, 2007 Posted May 21, 2007 Hi I've been using autoit for 3 weeks and tried to avoid asking in the forum since lot of my question has been answered using search but lately I'm having a problem with my program so here it is. I am having a problem making a recent file menu my question is Is it possible to change or set the text of GUICtrlCreateMenuitem? thanks in advance.
Kogmedia Posted May 21, 2007 Posted May 21, 2007 Hi I've been using autoit for 3 weeks and tried to avoid asking in the forum since lot of my question has been answered using search but lately I'm having a problem with my program so here it is.I am having a problem making a recent file menu my question isIs it possible to change or set the text of GUICtrlCreateMenuitem? thanks in advance.$filemenu = GUICtrlCreateMenu ("Menu Name Here") [font="Verdana"]Keith (Kogmedia)[/font]My ScriptQuick Search - Internet / Hard Drive Search
November Posted May 21, 2007 Posted May 21, 2007 Hi I've been using autoit for 3 weeks and tried to avoid asking in the forum since lot of my question has been answered using search but lately I'm having a problem with my program so here it is.I am having a problem making a recent file menu my question isIs it possible to change or set the text of GUICtrlCreateMenuitem? thanks in advance.Hi thereMaybe if you use GUICtrlSetData to change the titleCheers Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font]
Zedna Posted May 21, 2007 Posted May 21, 2007 Also GUICtrlDelete() may help. Resources UDF ResourcesEx UDF AutoIt Forum Search
Micoman Posted May 23, 2007 Author Posted May 23, 2007 Thanks for your fast reply @ Zedna - I think guictrlsetdata doesn't work for guictrlmenuitem but the guictrldelete does but my other problem is when I e replace the item the new menu item doesn't work. Thanks anyway have to search some example again
PaulIA Posted May 23, 2007 Posted May 23, 2007 Hi I've been using autoit for 3 weeks and tried to avoid asking in the forum since lot of my question has been answered using search but lately I'm having a problem with my program so here it is. I am having a problem making a recent file menu my question is Is it possible to change or set the text of GUICtrlCreateMenuitem? thanks in advance.Welcome to the forum. Here is an example of how to change the text of a menu item using Auto3Lib: expandcollapse popup#include <A3LMenu.au3> Global $hGUI, $hFile, $hHelp Global Enum $idNew=1000, $idOpen , $idSave, $idRecent, $idExit, $idAbout $hGUI = GUICreate("Menu Test", 400, 300) ; Create File menu $hFile = _Menu_CreateMenu() _Menu_AddMenuItem($hFile, "&New" , $idNew ) _Menu_AddMenuItem($hFile, "&Open" , $idOpen ) _Menu_AddMenuItem($hFile, "&Save" , $idSave ) _Menu_AddMenuItem($hFile, "" , 0 ) _Menu_AddMenuItem($hFile, "(Recent)", $idRecent) _Menu_AddMenuItem($hFile, "" , 0 ) _Menu_AddMenuItem($hFile, "E&xit" , $idExit ) ; Create Help menu $hHelp = _Menu_CreateMenu() _Menu_AddMenuItem($hHelp, "&About", $idAbout) ; Create Main menu $hMain = _Menu_CreateMenu() _Menu_AddMenuItem($hMain, "&File", 0, $hFile) _Menu_AddMenuItem($hMain, "&Help", 0, $hHelp) ; Set the window menu _Menu_SetMenu($hGUI, $hMain) GUISetState() ; Register command handler and wait for exit GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") do until GUIGetMsg() = $GUI_EVENT_CLOSE ; Handle menu commands Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) Switch _Lib_LoWord($iwParam) case $idNew _Lib_ShowMsg("New" ) _Menu_SetItemText($hFile, 4, "File 123") case $idOpen _Lib_ShowMsg("Open" ) _Menu_SetItemText($hFile, 4, "File 456") case $idSave _Lib_ShowMsg("Save" ) case $idRecent _Lib_ShowMsg(_Menu_GetItemText($hFile, 4)) case $idExit Exit case $idAbout _Lib_ShowMsg("About") EndSwitch Return $GUI_RUNDEFMSG EndFunc Auto3Lib: A library of over 1200 functions for AutoIt
Gif Posted May 23, 2007 Posted May 23, 2007 Thanks for your fast reply @ Zedna - I think guictrlsetdata doesn't work for guictrlmenuitem but the guictrldelete does but my other problem is when I e replace the item the new menu item doesn't work. Thanks anyway have to search some example againyou might have to create a Case again, if you want you can show us some example of your script , in order to help youTried to avoid asking in the forum
Gif Posted May 23, 2007 Posted May 23, 2007 (edited) Welcome to the forum. Here is an example of how to change the text of a menu item using Auto3Lib: expandcollapse popup#include <A3LMenu.au3> Global $hGUI, $hFile, $hHelp Global Enum $idNew=1000, $idOpen , $idSave, $idRecent, $idExit, $idAbout $hGUI = GUICreate("Menu Test", 400, 300) ; Create File menu $hFile = _Menu_CreateMenu() _Menu_AddMenuItem($hFile, "&New" , $idNew ) _Menu_AddMenuItem($hFile, "&Open" , $idOpen ) _Menu_AddMenuItem($hFile, "&Save" , $idSave ) _Menu_AddMenuItem($hFile, "" , 0 ) _Menu_AddMenuItem($hFile, "(Recent)", $idRecent) _Menu_AddMenuItem($hFile, "" , 0 ) _Menu_AddMenuItem($hFile, "E&xit" , $idExit ) ; Create Help menu $hHelp = _Menu_CreateMenu() _Menu_AddMenuItem($hHelp, "&About", $idAbout) ; Create Main menu $hMain = _Menu_CreateMenu() _Menu_AddMenuItem($hMain, "&File", 0, $hFile) _Menu_AddMenuItem($hMain, "&Help", 0, $hHelp) ; Set the window menu _Menu_SetMenu($hGUI, $hMain) GUISetState() ; Register command handler and wait for exit GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") do until GUIGetMsg() = $GUI_EVENT_CLOSE ; Handle menu commands Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) Switch _Lib_LoWord($iwParam) case $idNew _Lib_ShowMsg("New" ) _Menu_SetItemText($hFile, 4, "File 123") case $idOpen _Lib_ShowMsg("Open" ) _Menu_SetItemText($hFile, 4, "File 456") case $idSave _Lib_ShowMsg("Save" ) case $idRecent _Lib_ShowMsg(_Menu_GetItemText($hFile, 4)) case $idExit Exit case $idAbout _Lib_ShowMsg("About") EndSwitch Return $GUI_RUNDEFMSG EndFunc well Au3Lib seems to be the best solution, thanks for Au3Lib it helps a lot!! Edited May 23, 2007 by c4nm7
Micoman Posted May 23, 2007 Author Posted May 23, 2007 @ PaulIA - thanks a lot I'll give a try @ c4nm7 - Thanks for the idea anyway many of question in learning autoit is already in this forum except for this one or maybe I miss something on my search
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