PDA

View Full Version : More more menu bar


Roboblue
02-08-2006, 03:14 AM
I know that the menu bar items can be disabled (grayed out), but is there any way to remove a menu item completely from page to page?
I have an edit menu with 8 sub menus to edit items over a 6 page span. I want only the sub menu for that page to be seen. If i just disable the ones not on the page, I still have an 8 item list with 6-7 grays and 1-2 blacks. It just doesn't look very professional (kinda unfinished).
I am currently using lua files to buld the menu bar at runtime and it works mostly correct. But there are a couple of disadvantages to tha method as can be seen HERE. (http://www.indigorose.com/forums/showpost.php?p=74897&postcount=17)
So, I am going to try to do again with functions an on events, instead.

rhosk
02-08-2006, 05:52 AM
It's been a while since I messed with this, but you should definitely be able to customize the menu anywhere in the project, just rebuild the table at the page preload/show, etc.. :)

One (of probably a few) way to do it.

yosik
02-08-2006, 09:35 AM
1. You can have a page by page menu instead of a project wide menu. But I can see how it would be awkward to have to build one for each page...

Thinking outside the box, why not use a mask on the page you don't want the menu in and hide it?

Yossi

Roboblue
02-08-2006, 11:14 AM
1. You can have a page by page menu instead of a project wide menu. But I can see how it would be awkward to have to build one for each page...

Thinking outside the box, why not use a mask on the page you don't want the menu in and hide it?

Yossi
Yossi, good idea if you didn't want a menu at all. But for this project, I need the menu bar for all the pages, just not every sub menu.

Rhosk, After my morning two liters of caffiene, I am going to start working on a new menu and hoping to be able to do a page by page setup.
Whew, and I still need to write a 20-30 section Help that looks nice. Going on my 3rd month of this project and finally got the functionality debugged, now to pretty it up a bit. I actually have the menu bar working like I want, but the menu script files contain too much info on the programming involved that I don't want anyone to see. At least I have the menu flow correct and have a decent idea of the workings, so I'm not starting from scratch.
Thanx guys, I'll be back for more advice on this one.

rhosk
02-08-2006, 11:22 AM
Just a couple more pennies...put your scripts inside the project if you're concerned about prying eyes (as numerous functions, see next para).

And on my last project, I created large menu functions (with a bit of copy/paste, blah, blah) and just called the specific function to change the menu on the fly. For instance, I wanted the menu to totally grey out while an 'about' box popped up, just called the function.

I know it all may be obvious, just throwing out the ideas.

Good luck!

Roboblue
02-08-2006, 12:55 PM
Just a couple more pennies...put your scripts inside the project if you're concerned about prying eyes (as numerous functions, see next para).
I put the scripts in the Audio folder and after building (with resource folder renamed) it works fine and scripts are hidden.
Shoulda thought of that myself, but I'm too close to the project and neede an outside tip to reveal the obvious.
Definitely going to build functions for my menu item calls that are used more than once.
Thanx!

usernameCasper
11-15-2006, 05:14 AM
It's been a while since I messed with this, but you should definitely be able to customize the menu anywhere in the project, just rebuild the table at the page preload/show, etc.. :)

One (of probably a few) way to do it.

true, so u need to script every item from preload or onshow, but i dont think roboblue wants, he wants to do it via the GUI (project -> menubar).
Like in my previous post, i dont want this either, there must be a simple way where those items are called like ID = 100 to manipulate WHOLE the properties inside this item. So ID = 100 doesnt refer to any other properties in that item, can u change that in a later patch maybe? =)
maybe a idea, or just script ;) thats more fun than drag-and-drop =)

Kind Regards,
Casper

TristanD
11-15-2006, 10:39 AM
........................building (with resource folder renamed) ?? might be a noobt question :P how do you rename it? ;) :cool :rolleyes :lol :) :D

usernameCasper
11-15-2006, 11:13 AM
Ok, i fixed it, i came home, went 10 min coding, after a non sleeping night (thinking all night about that stupid menu bar code !! :o ) and i got the solution.

First u need to know is that my first item in the menubar is named "Bestand" and the next item is named "New Item".
ID doesnt matter, as long i give an example about the getText function, so enable/disable is even more easy.

This is my code example:

tblMenu = Application.GetMenu();
if(tblMenu)then
local nNumItems = Table.Count(tblMenu);
for index = 1, nNumItems do
local tblItemInfo = tblMenu[index]
local tblItemInfo1 = tblMenu[1]
if(tblItemInfo)then
--Prop = Prop..tblItemInfo.Text;
Prop = {Text=tblItemInfo.Text};
Prop1 = {Text=tblItemInfo1.Text};
end
end

Paragraph.SetProperties("Paragraph1",Prop);
Paragraph.SetProperties("Paragraph2",Prop1);
--Dialog.Message("Top Level Menu Items", Prop);
end


explanation; so "local tblItemInfo1 = tblMenu[1]", is tblItemInfo1 = tblMenu Item 1 in the menubar (cause we already counted the available tables, we select the first table, table number 1). With "Prop1 = {Text=tblItemInfo1.Text};" we convert the table Prop to Text. That Text we put down in a paragraph object.
Just see [1] as an array of tables.
Very confusing for people who know different program languages.

Hoped this worked for u :)
Kind Regards,
Casper

usernameCasper
11-15-2006, 11:41 AM
For the noobs, this is the full source code for SetText and SetBoolean from menu bar:


tblMenu = Application.GetMenu();
if(tblMenu)then
local nNumItems = Table.Count(tblMenu);
for index = 1, nNumItems do
local tblItemInfo = tblMenu[index]
local tblItemInfo1 = tblMenu[1]
local tblItemInfo2 = tblMenu[2]
if(tblItemInfo)then
--Prop = Prop..tblItemInfo.Text;
Prop = {Text=tblItemInfo.Text};
Prop1 = {Text=tblItemInfo1.Text};
Prop2 = {Text=tblItemInfo2.Text};
end
end

Paragraph.SetProperties("Paragraph1",Prop);
Paragraph.SetProperties("Paragraph2",Prop1);
Paragraph.SetProperties("Paragraph4",Prop2);
--Dialog.Message("Top Level Menu Items", Prop);

tblMenu[1].Enabled = false;
Application.SetMenu(tblMenu);

end

Just add the limegreen text into ur script to enable / disable items in a menubar

Roboblue
11-15-2006, 01:58 PM
........................building (with resource folder renamed) ?? might be a noobt question :P how do you rename it? ;) :cool :rolleyes :lol :) :D
When you publish the project, publish to a hard drive folder and just check the rename resource on the same window.

usernameCasper
Since this thread was started, I have gotten fairly knowledgeable on the menu/bar issue. After many hours, it finally clicked and I STILL see a lot of potential in the whole menu thing.
I'll try out your suggestion pretty soon.
thanx