Click to See Complete Forum and Search --> : How to create MenuItems ....efficiently ?


vnInformatics
March 29th, 2004, 12:58 AM
Hi everyone,

Now, I am having a trouble about MenuItems what i'd like to ask: The problem is addressed as:

- There are: Location, Building, Floor, and Unit what will be created as MenuItems.
- In order to make GUI familiar and easy to use, the user wants to make the Menu as look like:
Location
|_ Building
|_ Floor
|_Unit

- when the user clicks on Location MenuItem, the item will list all Building Items, as the same, when the user clicks on Building MenuItem the building item will list all Floor Items, as the same to Floor MenuItem and Unit MenuItem.

- Location: The max# is 30
- Building : The max# is 15
- Floor : The max# is 15
- Unit : The max# is 10

Simply to calculate i have to use: 30 x 15 x 15 x 10 = 67500 menuitems....hicc. This number is out of my imagination. If i do it programmatically the program runs so slow even though my computer is quite fast.

Hopefully that someone has already exerprienced these things, Please...please help me.

Thank for your help.

DSJ
March 29th, 2004, 11:31 AM
I think I'd use something like a treeview rather than menuitems! You could then either populate it up front with all the data or wait and populate it based on node-clicks.

vnInformatics
March 29th, 2004, 09:07 PM
Originally posted by DSJ
I think I'd use something like a treeview rather than menuitems! You could then either populate it up front with all the data or wait and populate it based on node-clicks.

Thanks for your adivice, But in my program i can't change to use TreeView or anythingelse, can use only MenuItems....

Although the number of Menuitems using so many, the program only run slow at the beginning. After that the program is able to run well, because of loading all menuitems at the beginning time.

Now, if i can improve the performance at the beginning time so i am sastified...

Thanks indeed for your help.

FrankG
March 30th, 2004, 09:50 AM
I don't have nearly what you have in menu items, but it does make me want to ask, do your menu items Change? Say You add a building, does that add one more set of floors to the menu?

Ouch! Here's some food for thought.

With mine, it's not locations, Building, Floors etc... but Vendors, Purchase Orders, Items, etc... I didn't use a menu system, except for the Generics of all of them. You can select the menu item vendors and get a Datagrid with all of the vendors and Select a "specific" line in the datagrid, (still working on this part) which causes another datagrid to open with all of that vendor's Purchase Orders, and (still in the planning stage) select a specific Purchase Order it opens another datagrid with all the details for the Purchase Order.

Alternately, my user could start with the Generic Purchase Orders, and get a datagrid with a sequencial list of all Purchase Orders for all vendors, and then when they select a specific Purchase Order, It opens up the Detail of that Purchase Order.

Let me ask you a question about menus. I don't have nearly as many as you, but I have about 10 menus with about 30 sub items under them. I defined my entire menu at the beginning and, by the return from the login, I comment out the specific lines of the menu visible. I used lines like

Me.ThisMenuItem.Visible = False
Me.ThatMenuItem.Visible = False
'Me.ThemMenuItem.Visible = False ]Sorry ran out of pronouns. :rolleyes:

In the above case, ThemMenuItem will show in the menu.

Is it better to create menu items programatically or to define them from the start? Especially when not every user will have the same access

Looking forward to hearing your ideas and your comments.

Frank

DSJ
March 30th, 2004, 11:02 AM
That's why the entire design is flawed... it doesn't scale at all! Say 30 more locations are added, your menu items have just doubled and the whole thing is totally unmanagable and unusable. Menus should be used to navigate the application, not navigate the data.

FrankG -
Typically I add all the menu items in the designer and then either enable/disable or change their visible property at runtime based on the user permissions, etc. I don't see anything inherantly wrong with creating them on the fly, but I just normally don't do it that way.

FrankG
March 30th, 2004, 12:30 PM
DSJ,
Great way to put it!:thumb: "...not navigate the data."

Now, I knew there was a reason I was using Datagrids.

vnInformatics
March 31st, 2004, 02:45 AM
Originally posted by FrankG
I don't have nearly what you have in menu items, but it does make me want to ask, do your menu items Change? Say You add a building, does that add one more set of floors to the menu?

Yes, in the program all the menuitems are able to be added as long as users want but the number is limited as above.

let say One example:
- if i have 10 locations, 8 buildings, 8 floors and 10 units. So in the Main menu will show them.
- Now if the user wants to add something more (ex: one new location or one new unti, ect..), so in the program also has to update the Main menu, in order to let it be corresponding to the data.


Originally posted by FrankG

Ouch! Here's some food for thought.

With mine, it's not locations, Building, Floors etc... but Vendors, Purchase Orders, Items, etc... I didn't use a menu system, except for the Generics of all of them. You can select the menu item vendors and get a Datagrid with all of the vendors and Select a "specific" line in the datagrid, (still working on this part) which causes another datagrid to open with all of that vendor's Purchase Orders, and (still in the planning stage) select a specific Purchase Order it opens another datagrid with all the details for the Purchase Order.

Alternately, my user could start with the Generic Purchase Orders, and get a datagrid with a sequencial list of all Purchase Orders for all vendors, and then when they select a specific Purchase Order, It opens up the Detail of that Purchase Order.

Great! But my boss doesnot want me to something like this. He just wants me to make the MenuItems...hiccc...I have already discussed it with him.

Actually, another part of this program also let the user be able to perform something as the same you did.

Originally posted by FrankG

Let me ask you a question about menus. I don't have nearly as many as you, but I have about 10 menus with about 30 sub items under them. I defined my entire menu at the beginning and, by the return from the login, I comment out the specific lines of the menu visible. I used lines like

Me.ThisMenuItem.Visible = False
Me.ThatMenuItem.Visible = False
'Me.ThemMenuItem.Visible = False ]Sorry ran out of pronouns. :rolleyes:

In the above case, ThemMenuItem will show in the menu.

Is it better to create menu items programatically or to define them from the start? Especially when not every user will have the same access

Looking forward to hearing your ideas and your comments.

Frank

I have been using this way, to create menu items programmatically.

At the loading time, all the menu items are loaded into the Main Menu even some of them are not used immediately. If menu items are not used at that time, the program will set thier Visible to be Invisible. When it is used in the program, it will be set to be Visible and also changed the index in order to sort them alphabetically.

Looking forward to hearing your ideas and your comments.

Thanks for your help.

vnInformatics
March 31st, 2004, 02:56 AM
Originally posted by DSJ
That's why the entire design is flawed... it doesn't scale at all! Say 30 more locations are added, your menu items have just doubled and the whole thing is totally unmanagable and unusable. Menus should be used to navigate the application, not navigate the data.

Good comments! I have thought about this problem, but i donot know how to fix this. Even most of the menu items, in the way i did, are not used immediately. They are used only when having a new menuitmes is added.


........
FrankG -
Typically I add all the menu items in the designer and then either enable/disable or change their visible property at runtime based on the user permissions, etc. I don't see anything inherantly wrong with creating them on the fly, but I just normally don't do it that way.

I didnot add all the menuitems at the designable time, instead of that, all the menuitems will be added at the loading time....But because of having so many menuitems...the program can run but so slow. After loading time, everything is OK.

Can you tell me the way to eliminate the loading time. In order to make the user feel good about the program...

I am looking forward to hearing from you any ideas and comments.

Thanks for your help.

Mr.Orange
March 31st, 2004, 10:16 AM
You could create a System.Threading.Thread in which you load the menu items in the background when your application is started. You would also probably need some other logic that extends a menu branch that has not being created yet by your thread if the user is advancing down that particular menu branch.

For example, you have:

Building1
Building2
Building3

Your thread begins by creating the rest of the Building1 menu, but the user clicks on the Building2 menu, which hasn't been created yet by your thread. You catch this click event and create the next level of the Building2 menu:

Building2
-- Floor1
-- Floor2
-- Floor3

The user now clicks on Floor2, but your thread is still working on the Building1 menu. Therefore, once again, you catch the click event and create the next level of the Building2 - Floor2 branch.

Building2
-- Floor2
------ Unit1
------ Unit2
------ Unit3

Note that you have only extended a single branch that you needed because of user demand. The other branches will be extended by your thread when it gets to them.

Hope this is along the lines of what you were looking for.

vnInformatics
March 31st, 2004, 09:26 PM
Originally posted by Mr.Orange
You could create a System.Threading.Thread in which you load the menu items in the background when your application is started. You would also probably need some other logic that extends a menu branch that has not being created yet by your thread if the user is advancing down that particular menu branch.

For example, you have:

Building1
Building2
Building3

Your thread begins by creating the rest of the Building1 menu, but the user clicks on the Building2 menu, which hasn't been created yet by your thread. You catch this click event and create the next level of the Building2 menu:

Building2
-- Floor1
-- Floor2
-- Floor3

The user now clicks on Floor2, but your thread is still working on the Building1 menu. Therefore, once again, you catch the click event and create the next level of the Building2 - Floor2 branch.

Building2
-- Floor2
------ Unit1
------ Unit2
------ Unit3

Note that you have only extended a single branch that you needed because of user demand. The other branches will be extended by your thread when it gets to them.


Thanks for your advice, i am impressed in this way. I will try now.


Hope this is along the lines of what you were looking for.
Exactly as what i want!


Once again, thank all of you for your help!

vnInformatics
March 31st, 2004, 09:29 PM
Originally posted by Mr.Orange
You could create a System.Threading.Thread in which you load the menu items in the background when your application is started. You would also probably need some other logic that extends a menu branch that has not being created yet by your thread if the user is advancing down that particular menu branch.

For example, you have:

Building1
Building2
Building3

Your thread begins by creating the rest of the Building1 menu, but the user clicks on the Building2 menu, which hasn't been created yet by your thread. You catch this click event and create the next level of the Building2 menu:

Building2
-- Floor1
-- Floor2
-- Floor3

The user now clicks on Floor2, but your thread is still working on the Building1 menu. Therefore, once again, you catch the click event and create the next level of the Building2 - Floor2 branch.

Building2
-- Floor2
------ Unit1
------ Unit2
------ Unit3

Note that you have only extended a single branch that you needed because of user demand. The other branches will be extended by your thread when it gets to them.


Thanks for your advice, i am impressed in this way. I will try now.


Hope this is along the lines of what you were looking for.
Exactly as what i want!


Once again, thank all of you for your help! :thumb: