how to add code to menuitems ?!

Hi
Im trying desperately to understand how to add code to menu items but i can’t
I try to “add to menu item” but all the options are greyed out, the only two that are availabel are “database” and “build step”
I think I should click “event handler” but it’s greyed !!

any ideas ?!
thanks regds

oh and I can’t even delete the menuitems I created. Delete and cut won’t work …

Have you read about menus in the documentation?

http://41160df63757fc043cfd-66287f38a83954e31a54d1dbe33e0650.r4.cf2.rackcdn.com/Documentation/UserGuide-UserInterface.pdf

site: 103 Menu Handlers.

no, i don’t read the documentation for something that i expect to be easy , but apparently in xojo it’s not that straightforward

I don’t know if there exists a programming environment anywhere in the world where even if you’re “desperate” you don’t even try to look at documentation, but I can almost assure you Xojo isn’t it.

And I can’t think of many easier to get a hang of, either.

The best way to learn without read the documentation is to download the source code of sample program and look how they are made. And you have a lot of exemples with Xojo.

But effectively, like many things, we get upset when we learn. And one we know, we ask ourself why we upset before :slight_smile: .

[quote=105782:@Eduardo Gutierrez de Oliveira]I don’t know if there exists a programming environment anywhere in the world where even if you’re “desperate” you don’t even try to look at documentation, but I can almost assure you Xojo isn’t it.

And I can’t think of many easier to get a hang of, either.[/quote]
In VB6 IDE, when a form with menu is open in design view then by opening the menu, if any menuitem is selected then the VB6 IDE brings the “menuitem handler” “code editor” in to view. Maybe that is what Horacio has in mind and expects from Xojo.

It is VERY easy… if only you were willing to make a tiny investment

But this is XOJO… not VB6… so the OP problem is not that it is difficult, but that it is different, and he cannot be bothered with learning… (my biggest pet peeve… but that is another topic)

And attiitudes of “I don’t need to” , “I don’t want to” coupled with “Do it for me” … just won’t fly…

Friend the case is simple LEARN, if you do not want to read anything about it and want others to solve everything for you is difficult, not to say impossible.

And I speak to you as well use the forum and can ALWAYS help me as it is not always enough and then I have to learn alone.

[quote=105786:@Thomas ROBISSON]The best way to learn without read the documentation is to download the source code of sample program and look how they are made. And you have a lot of exemples with Xojo.

But effectively, like many things, we get upset when we learn. And once we know, we ask ourself why we upset before :slight_smile: .[/quote]

I think my version has a bug because the “add menu event handler” is not selectable also I cannot delete or cut the menus, I’ve read before that the ide can be buggy sometimes

You probably are trying to add a menu handler to a menubar - this is not how it works! A menu handler is added to App, or a Window, or a ContainerControl, or any RectControl subclass (TextField, Listbox, etc.).

Read the introduction in “Book 2: User Interface” on Main Page , page 103.

If you select a window, any window in the left pane, right click and select Add… you will see the option “Menu handler”.

I’m still having trouble grasping the concept of someone not wanting to read documentation in order to solve their problem??

We have a lot of people that start using Xojo assuming it is just like VB, operates like VB and since they are very familiar with VB they don’t need to read the manuals. Then they get frustrated because its not.
The language is different, the runtime is not the same and the IDE is not the same - and similar concepts can/do work differently.
DoEvents is one.

In the menu editor, click on the menu item (for instance Untitled) and make sure the name in the inspector in the right pane is not selected (blue). Only the menu item itself should be selected. Type backspace (the key on top right of the keyboard).

This is not a bug. Often people accuse Xojo to be bugged because their own code is flawed. Common in any programming environment.

[quote=105733:@Horacio Vilches]Hi
Im trying desperately to understand how to add code to menu items but i can’t
I try to “add to menu item” but all the options are greyed out, the only two that are availabel are “database” and “build step”
I think I should click “event handler” but it’s greyed !!

any ideas ?!
thanks regds[/quote]

I know there’s a bug on Windows where If you select add menu handler, after you choose the menuname, you must (literally) press enter for the name to take recognition in Xojo. It will appear that all is well, but it took me days to discover how to find a solution to the bug back in early may. The menu handlers appeared, code appeared when selecting the menuhandler, but the tell-tale sign was the greyed out menuitems. I went back, clicked on the menu names in the inspector, pressed enter for each, rebuilt, and the menus suddenly started working.

The previous release didn’t demonstrate the issue.

Jesus christ almighty in heaven I just found how to do it randomly because there is no way in hell you can figure out how to do it on an intuitive level…
Anyhow, thanks for the help !

Peace out !

You are correct. For pre-defined menus this could be done. Since most of my menus are dynamic there would be no way for the IDE to easily know what they are.

“Intuitive” is a relative term. It refers to previous experiences and, as mentioned before, these can be more of a crutch than help when trying to make one program behave like another. I find the Xojo IDE oceans more intuitive than, for example, Xcode. But the complaint you have is more related to how the language works.

I find it understandable to try and get the hang of a language without reading docs, but the docs are there for the times you can’t. It makes no sense that you prefer to post to a forum than read the docs (not having understood the docs would be a different matter, and we’d all empathize of course).