Holger Posted July 2, 2004 Share Posted July 2, 2004 (edited) Nooooo, it's not implemented yet.I played a little bit around and found a good lesson about menu-programming...Here is my first GUI with a menu At the moment it's more like "Hello world" you know...Here is a sample:http://www.autoitscript.com/fileman/users/public/Holger/guiwithmenu.jpgBUT: don't think about it in the next few weeks, it takes some time to learn c++ (for me)...Maybe YOU want to develope this new 'control' I hope I'll find time to learn more about menu's...Regards Holger Edited July 23, 2004 by Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
SlimShady Posted July 2, 2004 Share Posted July 2, 2004 (edited) Nooooo, it's not implemented yet.I played a little bit around and found a good lesson about menu-programming...Here is my first GUI with a menu At the moment it's more like "Hello world" you know...Here is a sample:... image ...BUT: don't think about it in the next few weeks, it takes some time to learn c++ (for me)...Maybe YOU want to develope this new 'control' I hope I'll find time to learn more about menu's...Regards HolgerToo bad... I was just about to say "Thank you".I hope someone else figures this out.I wanted this some time ago, but I forgot to post it in the "Ideas" section. Edited July 2, 2004 by SlimShady Link to comment Share on other sites More sharing options...
Holger Posted July 3, 2004 Author Share Posted July 3, 2004 (edited) @SlimShady:I would NOT say "Mission Impossible" but it takes time (I think) to realize that).At the moment I know a little bit more about that, I use i.e. this code:GUICreate("test",300,200) $menu1 = GUISetMenu("menu","Menu1") $menu2 = GUISetMenu("menu","Menu2") $submenu1 = GUISetMenu("submenu","Submenu1",$menu1) $item1 = GUISetMenu("item","Item1",$menu1) $item2 = GUISetMenu("item","Item2",$menu2) $item3 = GUISetMenu("item","Item3",$submenu1) $buttonok = GUISetControl("button","OK",120,150,70,20) GUISetControlNotify() GUIShow() While GUIMsg() <> 0 $msg = GUIRead() Msgbox(0,"",$msg) If $msg = -3 Then ExitLoop WENd GUIDelete() Exitand it will bring up that:http://www.autoitscript.com/fileman/users/public/Holger/guiwithsub.jpgSo the types can be: "menu", "item", "submenu" and "separator".Now I try to change the GUIRead-function -> but it looks like that I have to use a complete/new/other function, i.e. "GUIReadMenu" cause the 'handling' in the most arrays and functions is for HWND-types and I have to use the type HMENU...Maybe in the future I will create a equivalent function to "GUISetControlEx" and will call it "GUISetMenuEx". With this you can also set the state of menus and menitems (like 'disabled', 'enabled', 'grayed out')...So if nobody disagree with it I will post my realized new steps here you knowRegards Holger Edited July 23, 2004 by Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
bobheart Posted July 4, 2004 Share Posted July 4, 2004 I must have something diff ? --------------------------- AutoIt Error --------------------------- Line 3 (File "E:\Programs\AutoIt3\Examples\jul2\SetMenu.au3"): $menu1 = GUISetMenu("menu","Menu1") $menu1 = ^ ERROR Error: Unknown function name. Link to comment Share on other sites More sharing options...
Holger Posted July 4, 2004 Author Share Posted July 4, 2004 @bobheart: did you read the subtitle of this topic? maybe possible in the future So long...Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
bobheart Posted July 4, 2004 Share Posted July 4, 2004 naaa i just try things and bitch when they don't work .. hahahahaha Link to comment Share on other sites More sharing options...
cowsmanaut Posted July 4, 2004 Share Posted July 4, 2004 Just had a thought .. not sure if it's possible but could you not create a psudo menu by updating the number of buttons on the GUI? I noticed that the last button defined on the list shows on top of others.. even when overlapping.. so in this way when you click your "menu" you could set a string of new buttons over top and when one was selected you could then reupdate the GUI to not have them anymore.. not sure if it's possible.. but it would be an interesting hack if anything moo Link to comment Share on other sites More sharing options...
Holger Posted July 5, 2004 Author Share Posted July 5, 2004 (edited) Hmmm...I don't know... However...I'm a little bit more in programming, so you could see a compiled script with GUIMenu-functions here:http://www.autoitscript.com/fileman/users/public/Holger/guimenu.exeThat looks so:http://www.autoitscript.com/fileman/users/public/Holger/guimenu.jpgThe script is a bit more complex than the 'normal' GUIScript, but I have no problems with it...The errorchecking is only at the beginning and so on... but it grows GUICreate("test",300,200) $filemenu = GUISetMenu("menu","File") $helpmenu = GUISetMenu("menu","?") $fileitem = GUISetMenu("item","Open...",$filemenu) $aboutitem = GUISetMenu("item","About",$helpmenu) $exititem = GUISetMenu("item","Exit",$filemenu) $recentfilesmenu = GUISetMenu("submenu","Recent Files",$filemenu,1) $separator1 = GUISetMenu("separator","",$filemenu,2) $okbutton = GUISetControl("button","OK",50,130,70,20) GUISetControlNotify() $cancelbutton = GUISetControl("button","Cancel",180,130,70,20) GUISetControlNotify() GUIShow() While GUIMsg() <> 0 $msg = GUIRead() If $msg = -3 Or $msg = $cancelbutton Then ExitLoop If $msg = $fileitem Then $file = FileOpenDialog("Choose file...",@TempDir,"All (*.*)") If @error <> 1 Then ;maybe in the future weeks ; GUIWriteMenu(....) GUISetMenu("item",$file,$recentfilesmenu) EndIf EndIf If $msg = $exititem Then ExitLoop If $msg = $aboutitem Then Msgbox(0,"About","Only a test...") WENd GUIDelete() ExitBut for today it's enough... have to go sleep...Yeah that is fun Regards HolgerP.S.:ahh..forgot...the exe is smaller than the normal Autoit3.exe cause I exluded most functions before compiling..Edit: 05.07.2004: GUIReadMenu is not more needed Edited July 23, 2004 by Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
tutor2000 Posted July 5, 2004 Share Posted July 5, 2004 I know you guys love gui But all this is possible already using an hta vbs, javascript, dhtml, and autoitx Rick Link to comment Share on other sites More sharing options...
CyberSlug Posted July 5, 2004 Share Posted July 5, 2004 I know you guys love guiBut all this is possible already using an hta vbs, javascript, dhtml, and autoitxRickYou could say the same thing about AutoIt itself However, an open-source, self-contained, easy-to-use scripting language that can be compiled into stand-alone EXEs that work on Windows 9x/Me/NT/2000/XP/etc. has appeal. Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
tutor2000 Posted July 5, 2004 Share Posted July 5, 2004 You could say the same thing about AutoIt itself However, an open-source, self-contained, easy-to-use scripting language that can be compiled into stand-alone EXEs that work on Windows 9x/Me/NT/2000/XP/etc. has appeal.Choice is a great thingI like the HTAs with auoitx because I can incorporate everything that I can on a webpage and use run in autoitx to run compiled scriptsGreat combo especially for this nonreal programmerRick Link to comment Share on other sites More sharing options...
Holger Posted July 5, 2004 Author Share Posted July 5, 2004 However:I add the menufunctions from GUIReadMenu to GUIRead so there will be only the known function GUIRead([ctrlref]) to read out the state or value from the menu(items)...Next will be maybe GUISetMenuEx...we will see Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
Josbe Posted July 5, 2004 Share Posted July 5, 2004 However: I add the menufunctions from GUIReadMenu to GUIRead so there will be only the known function GUIRead([ctrlref]) to read out the state or value from the menu(items)... Next will be maybe GUISetMenuEx...we will see Holger Yeah....Why not? Great, Holger. (Is needed for GUI additions, like a Slider control too...) AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
Holger Posted July 8, 2004 Author Share Posted July 8, 2004 (edited) I'm a little bit busy the days, but I will send the changed source-code to JPM on lately saturday so he can modify it and make it better.The last I worked on was "GUISetMenuEx" and it worked so far (a little bit).The most problems I had with "WM_MENUSELECT".So if you move the mouse over a menu(item) this message will send but here it will only send the 'right' if you click another time (so that menu closes).And I have no idea why...hmmm... Maybe JPM will find something about that point.You know this using - if you click on a menu then in many programs on the statusbar will be displayed i.e. an info about this item...Another thing is to create radio-menu-items.But normal check-menu-items work. I changed a few days ago the code a little bit, so if you would use:$filemenu = GUISetMenu("menu","File")you can append an item with:$fileitem = GUISetMenu("item","Open...",$filemenu)or$fileitem = GUISetMenu("item","Open...")And if you can change the position, i.e:$menu1 = GUISetMenu("menu","menu1")$menu2 = GUISetMenu("menu","menu2")$menu3 = GUISetMenu("menu","menu3",1)That will bring the menu3 to position 1.!!! You have to know that the positions in menus are only begin with "0" - like in arrays you know...Ok, so long...RU (read you) and regardsHolger Edited July 8, 2004 by Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
Holger Posted July 9, 2004 Author Share Posted July 9, 2004 So...I'm sending now JPM the changed things so he can take a look and make/add the right lines At the moment GUISetMenuEx works so far you know.Here is what I mean:http://www.autoitscript.com/fileman/users/public/Holger/guiwithsetmenuex.jpgI have updated the sample that you could see a little bit more.You can now i.e. change the view of the statusline...http://www.autoitscript.com/fileman/users/public/Holger/guimenu.exeAnd here is the (possible) AutoIt3-script to do this:expandcollapse popup#include "GUIConstants.au3" Global $defaultstatus = "Ready" GUICreate("test",300,200) $filemenu = GUISetMenu("menu","&File") $fileitem = GUISetMenu("item","Open",$filemenu) GUISetMenuEx(-1,$GUI_DEFBUTTON) $helpmenu = GUISetMenu("menu","?") $saveitem = GUISetMenu("item","Save",$filemenu) GUISetMenuEx(-1,$GUI_DISABLE) $infoitem = GUISetMenu("item","Info",$helpmenu) GUISetMenuNotify() ;$exititem = GUISetMenu("item","E&xit\tAlt+F4",$filemenu) ;still have problems with accelerators -> will not right read to internal function $exititem = GUISetMenu("item","Exit",$filemenu) $recentfilesmenu = GUISetMenu("submenu","Recent Files",$filemenu,1) $separator1 = GUISetMenu("separator","",$filemenu,3) $viewmenu = GUISetMenu("menu","View",1) $viewstatusitem = GUISetMenu("item","Statusbar",$viewmenu) GUISetMenuEx(-1,$GUI_CHECKED) $okbutton = GUISetControl("button","OK",50,130,70,20) GUISetControlNotify() GUISetControlEx(-1,$GUI_FOCUS) $cancelbutton = GUISetControl("button","Cancel",180,130,70,20) $statuslabel = GUISetControl("label",$defaultstatus,0,165,300,16,BitOr($SS_SIMPLE,$SS_SUNKEN)) GUIShow() While 1 $msg = GUIMsg() ;Msgbox(0,"GUIMsg_ID",$msg) If $msg = $fileitem Then $file = FileOpenDialog("Choose file...",@TempDir,"All (*.*)") If @error <> 1 Then GUISetMenu("item",$file,$recentfilesmenu) EndIf If $msg = $viewstatusitem Then If BitAnd(GUIRead($viewstatusitem),$GUI_CHECKED) = $GUI_CHECKED Then GUISetMenuEx($viewstatusitem,$GUI_UNCHECKED) GUISetControlEx($statuslabel,$GUI_HIDE) Else GUISetMenuEx($viewstatusitem,$GUI_CHECKED) GUISetControlEx($statuslabel,$GUI_SHOW) EndIf EndIf If $msg = -3 Or $msg = $cancelbutton Or $msg = $exititem Then ExitLoop If $msg = $infoitem Then Msgbox(0,"Info","Only a test...") WEnd GUIDelete() ExitWe will see what the future brings and what JPM maybe says next week...Regards and a nice weekend Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
tuape Posted August 2, 2004 Share Posted August 2, 2004 Can you confirm if this will be included in the unstable build? I was just wondering because I would have some use for it Link to comment Share on other sites More sharing options...
Holger Posted August 2, 2004 Author Share Posted August 2, 2004 It's still in developement Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
tuape Posted August 2, 2004 Share Posted August 2, 2004 Ok, then I think I will look for a workaround. I saw a VB application on Planet sourcecode which let's you add menu's to any programs (all you have to know is program windows name or handle). I think I could make a C application that adds menus to my AutoITGUI scripts since I can get the handle from the script. I'm not sure if I can react to menu messages that way, but let's see... Link to comment Share on other sites More sharing options...
tuape Posted August 5, 2004 Share Posted August 5, 2004 Ok, now I have an application I can use to add menus to my AutoIT3 GUI scripts. The problem is that I can't catch messages from menuitems. I have added an identifier to my menuitems, say '9801' or something. Then when I try to catch a menuitem click like this: if $msg = "9801" Then ... It won't work. Holger, do you have any ideas? Maybe this can't be done then? Link to comment Share on other sites More sharing options...
Holger Posted August 5, 2004 Author Share Posted August 5, 2004 Where I can get this application (whats the name)? But hurry up I will be away from home from tomorrow Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView 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