crzftx Posted October 7, 2008 Share Posted October 7, 2008 I have a GUI with a menu. Let's pretend it has "Options", "Help", and "Exit" on the menu bar. But I don't want each button to be it's own Menu, but simply a MenuItem. If I don't have any Menus on the bar, the MenuItems don't show up. I put a GUICtrlCreateMenu("") in there, but then there's a blank button. Any ideas? Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted October 7, 2008 Share Posted October 7, 2008 I am not exactly sure what you mean but it sounds more like a toolbar than a menu to me, check the example for _GUICtrlToolbar_AddString() in the helpfile .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
crzftx Posted October 7, 2008 Author Share Posted October 7, 2008 Couldn't see how that works without accompanying pictures, but maybe missing something. expandcollapse popup#include <GuiToolbar.au3> Opt("GUIOnEventMode",1) $guiMain = GUICreate("Test GUI",300,300) GUISetFont(11,500,0,"Verdana") $toolbar = _GUICtrlToolbar_Create($guiMain) $menuStatistics = _GUICtrlToolbar_AddString($toolbar,"Statistics") ;$menuStatistics = GUICtrlCreateMenuItem("Statistics",-1) GUICtrlSetOnEvent(-1,"ShowStatistics") $menuOptions = _GUICtrlToolbar_AddString($toolbar,"Options") ;$menuOptions = GUICtrlCreateMenuItem("Options",-1) GUICtrlSetOnEvent(-1,"ShowOptions") $menuHelp = _GUICtrlToolbar_AddString($toolbar,"Help") ;$menuHelp = GUICtrlCreateMenuItem("Help",-1) GUICtrlSetOnEvent(-1,"ShowHelp") GUISetOnEvent(-3,"Quit") GUISetState() While 1 Sleep(25) WEnd Func ShowStatistics() ConsoleWrite("User pressed Statistics" & @CRLF) EndFunc Func ShowOptions() ConsoleWrite("User pressed Options" & @CRLF) EndFunc Func ShowHelp() ConsoleWrite("User pressed Help" & @CRLF) EndFunc Func Quit() Exit EndFunc Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted October 7, 2008 Share Posted October 7, 2008 (edited) I was thinking you could use _GUICtrlToolbar_AddButton() without setting a image by having "-2" as the third parameter, but now when I try it I see that it is really ugly and is perhaps not a good solution... Sry mate. Just wait and someone (probably rasim or martin ) will post something better Edited October 7, 2008 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
rasim Posted October 8, 2008 Share Posted October 8, 2008 crzftxHmm... very strange. Without a "main" menu menuitems doesn't displayed, i didn't know that. Anyway you can create a menu controls using a _GUICtrlMenu_* functions, see in the help file. expandcollapse popup#include <GuiToolbar.au3> Opt("GUIOnEventMode",1) $guiMain = GUICreate("Test GUI",300,300) GUISetFont(11,500,0,"Verdana") $MenuFile = GUICtrlCreateMenu("&File") ;Main menu $menuStatistics = GUICtrlCreateMenuItem("Statistics", -1) GUICtrlSetOnEvent(-1, "ShowStatistics") $menuOptions = GUICtrlCreateMenuItem("Options", -1) GUICtrlSetOnEvent(-1, "ShowOptions") $menuHelp = GUICtrlCreateMenuItem("Help", -1) GUICtrlSetOnEvent(-1, "ShowHelp") GUISetOnEvent(-3,"Quit") GUISetState() While 1 Sleep(25) WEnd Func ShowStatistics() ConsoleWrite("User pressed Statistics" & @CRLF) EndFunc Func ShowOptions() ConsoleWrite("User pressed Options" & @CRLF) EndFunc Func ShowHelp() ConsoleWrite("User pressed Help" & @CRLF) EndFunc Func Quit() Exit EndFunc Link to comment Share on other sites More sharing options...
ProgAndy Posted October 8, 2008 Share Posted October 8, 2008 Strange ... but you can delete the Menu after you have created the first item expandcollapse popup#include <GuiToolbar.au3> Opt("GUIOnEventMode",1) $guiMain = GUICreate("Test GUI",300,300) GUISetFont(11,500,0,"Verdana") $MenuTemp = GUICtrlCreateMenu("TempItem") ;Main menu $menuStatistics = GUICtrlCreateMenuItem("Statistics", -1) GUICtrlSetOnEvent(-1, "ShowStatistics") ; now We have an Item and can delete the TempMenu again :) GUICtrlDelete($MenuTemp) $menuOptions = GUICtrlCreateMenuItem("Options", -1) GUICtrlSetOnEvent(-1, "ShowOptions") $menuHelp = GUICtrlCreateMenuItem("Help", -1) GUICtrlSetOnEvent(-1, "ShowHelp") GUISetOnEvent(-3,"Quit") GUISetState() While 1 Sleep(25) WEnd Func ShowStatistics() ConsoleWrite("User pressed Statistics" & @CRLF) EndFunc Func ShowOptions() ConsoleWrite("User pressed Options" & @CRLF) EndFunc Func ShowHelp() ConsoleWrite("User pressed Help" & @CRLF) EndFunc Func Quit() Exit EndFunc *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
rasim Posted October 9, 2008 Share Posted October 9, 2008 ProgAndyHey! Nice solution! 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