xeroTechnologiesLLC Posted February 5, 2012 Share Posted February 5, 2012 (edited) Is it possible to use form 2 to call a function to create menu items onto form 1? I apologize for probably a simple question, but I'm not finding clear syntax on how to accomplish it. In .net i guess it would just be ... like create frm1.menu.value = whatever, etc. I'm not sure how to implement that into autoIT syntax - if I even can. Thanks in advance. Edited April 7, 2012 by xeroTechnologiesLLC Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 5, 2012 Moderators Share Posted February 5, 2012 xeroTechnologiesLLC,I thought we already did that in one of your other threads? As long as you use GUISwitch to set the correct GUI in which to create the controls you can use the standard AutoIt GUICtrlCreate* functions from anywhere in your script. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
xeroTechnologiesLLC Posted February 5, 2012 Author Share Posted February 5, 2012 LOL silly Melba...you know I can't read and have the memory of a brick... So I tried the following to basically clear the ini section of the list of items we hid, destroy the menu bar (since other items were destroyed it's easier to clear it all then rebuild it) and then run a function to rebuild the menu items. Unfortunately it doesn't destroy all the items, it leaves a few behind. What am I missing? Case $ShowAll ; clear the information in the .ini file IniWriteSection("config.ini", "MenuHideShow", "") ; recreate the menu bar in the $FRMtoolbox window GUISwitch($FRMtoolbox) GUISetState() _GUICtrlMenu_DestroyMenu($FRMtoolbox) backupMenu() _GUICtrlMenu_DrawMenuBar($FRMtoolbox) ; resize the menu bar to fit for the recreated items #region --- resize toolbox --- ; resize the toolbox to the width of the left over buttons $hWnd = WinGetHandle("ToolBox") $hMain = _GUICtrlMenu_GetMenu($hWnd) $c = 0 $btnWidth1 = 0 Do $c += 1 $mInfo = _GUICtrlMenu_GetMenuBarInfo($FRMtoolbox, $c, 1) $btnWidth1 += $mInfo[2] - $mInfo[0] Until $mInfo[2] = 0 $screenW = $btnWidth1 + 15 WinMove("ToolBox", "", $screenX, $screenY, $screenW) #endregion --- resize toolbox --- Thanks in advance...and again - sorry for all the dumb questions. >< Link to comment Share on other sites More sharing options...
xeroTechnologiesLLC Posted February 5, 2012 Author Share Posted February 5, 2012 The function to add the new ones works just fine, so all I need at this point is to remove those others... Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 5, 2012 Moderators Share Posted February 5, 2012 xeroTechnologiesLLC,No idea from just that snippet. Are all the menu items created by the same _GUICtrlMenu_CreateMenu call? If not then _GUICtrlMenu_DestroyMenu will not delete them. Perhaps if you post the whole script.... M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
xeroTechnologiesLLC Posted February 5, 2012 Author Share Posted February 5, 2012 Ah that would explain it.originally they were just made with GUICtrlCreateMenu and GUICtrlCreateMenuItem.I have to use the GUICtrlDelete in a loop or something to remove the items then, correct? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 5, 2012 Moderators Share Posted February 5, 2012 xeroTechnologiesLLC, Ah, the crystal ball is working well tonight! Yes, you will need to loop through the returned ControlIDs as I did in the very early scripts I posted in your other thread. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
xeroTechnologiesLLC Posted February 5, 2012 Author Share Posted February 5, 2012 (edited) I'll definitely need to make note of the difference for the future. I can see how the _guictrlmenu_createMenu option in conjunction with the .ini file would have made this add/remove process infinitely smoother than the methodology I have it now. The lessons will be shared with the rest of the team as well since we are all picking up autoIT and learning it about the same time. I have one more hurdle of a persistent menu item that retains even after i use the guictrldelete for it's menu ID, but I think I can get around that. For this topic - [RESOLVED] ! LOL Melba - I owe you drinkage or something. Thank you again! ;) edit - spelling fail corrected Edited February 5, 2012 by xeroTechnologiesLLC Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 5, 2012 Moderators Share Posted February 5, 2012 xeroTechnologiesLLC,I owe you drinkage or somethingThank you for the thought. Perhaps a donation to the site to help Jon with the server costs instead? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
xeroTechnologiesLLC Posted February 5, 2012 Author Share Posted February 5, 2012 consider it done when i get home. (keyloggers at work ftl) I have some more coding to do on this last item of the project then it's complete. I'll be cleaning up the code, removing some work proprietary stuff and then probably (if it's ok to the forum rules) just give the code away when it's complete and stable. Mainly in a thank you for the help - here's what I completed. Second as a - don't do this...it was inefficient, but worked like sludge on slope. LOL Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 5, 2012 Moderators Share Posted February 5, 2012 xeroTechnologiesLLC, You are very kind - thank you. Feel free to post your final code here - either as a working example or as a "warning to others" showing both approaches. After all, that is why the forum exists - to let others learn. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
xeroTechnologiesLLC Posted February 5, 2012 Author Share Posted February 5, 2012 And with all your knowledge and help, my first major AutoIT project is complete and now our team has a floating menu that: relaunches in the same location it closes (also allowing for floating freely) gives the user the ability to permanently hide/show menu items hide individual menus gives the user the choice to show the program in just the system tray or on the start bar create their own menu and sub menus with items ....and other stuff i can't even think of.... LOL I am a happy noob-grammer! hahah Thank you very much Melba. Infinite appreciation in your assistance and instructions. ;) 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