Jump to content

Creating a button in the menu?


Recommended Posts

Hello

I've already ask the question in the topic description :)

but here it comes again.

I have this menu:

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Menu = GUICreate("MENU", 374, 203, 456, 204)
$MenuItem1 = GUICtrlCreateMenu("Homepage")
GUISetState(@SW_SHOW)

While 1
WEnd

Is it possible to make $MenuItem1 to a button, that for expample could show a msgbox? without have to make a submenu?

Ask if you don't understand what I mean ;)

Regards

Link to comment
Share on other sites

I actually dont know, if it's really called "toolbar" then why is it called "rebar" in the helpfile??

Might want to look again in the help, a rebar holds 1 or more toolbars or controls.

Edited by GaryFrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

I think that what the OP wants is to be able to perform an action by simply clicking on a Menu instead of a having to create a MenuItem. That can't be done (AFAIK), however if all he wants is an item on the main menu bar that will perform an action, that we can do. Just place this in your Menu code. It places a clickable item in the main menu bar.

Global $Menu_Test = GUICtrlCreateMenuItem("Test", -1)

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

GEOSoft you were absolutly right.. I look in the help file, but didn't understand what to do, now I know.. I just have to place a -1.. simple, but smart :)

Thanks

- By the way does any of you know why it makes error when I try to make my whole script into a function like

Func _script()

; whole script comes here

EndFunc ;==> _script()

I would like to do this because then I can just #include the .au3 in the menuGUI.au3 and then call the function if the button been pressed?

because I can't make it work right now..

Edited by newbiescripter
Link to comment
Share on other sites

GEOSoft you were absolutly right.. I look in the help file, but didn't understand what to do, now I know.. I just have to place a -1.. simple, but smart :)

Thanks

- By the way does any of you know why it makes error when I try to make my whole script into a function like

Func _script()

; whole script comes here

EndFunc;==> _script()

I would like to do this because then I can just #include the .au3 in the menuGUI.au3 and then call the function if the button been pressed?

because I can't make it work right now..

Probably becuase you have other functions in your script and you can not create a function inside of another function.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

I've heard something about the an adlib - something who could do that.. but if I can't is there then any smarter way to insert it into the GUI insted of posting the whole code in there?

In all fairness, we would have to take a look at your existing script and an idea of what you want to do. AdLib is probably not the way to go. I suspect that it's just a matter of separating your functions.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...