December 18th, 2002, 09:37 AM
Join Date: Dec 2002
Time spent in forums: < 1 sec
Reputation Power: 0
== Toolbar Algorithm? ==
Need someone to help me on this subject...
>> Task: Menu/Toolbar system (JScript).
I've already built a JS/CSS Toolbar Menu system, for my app.
It suports multiple menus, each filled with "n" buttons;
My goal here is to integrate in an app. a menu system like IE, or Word...
>> Capabilities: Show/Hide Menu; Parse Button's State.
So far, my menu sys. supports show/hide Menus & inside each menu, the buttons can assume 2 states : enabled or disabled.
i'm "parsing" button state by paasing an array to a function, something like this:
(assume that PassedArray = "0,0,1,1,0,1,0,0,1")
// 0 = Disabled; 1= Enabled;
function objHandleButtons(MenuID, PasssedArray)
//-- something like:
for (var i=0;i<=PassedArray.lentgh -1;i++)
if (PassedArray(i) == 0)
objButton(i).disabled = true;
objButton(i).disabled = false;
>> Nothing new, he?!
I've used this for my project and it works fine, but...
now i got 5 distinct menus, with button ranges from 4 to 11!
Imagine the huge quantity of arrays i'm supossed to manage!
For each button clicked i must have an array, to control wich other buttons are enabled or not, and not counting the exceptions handling...
For Menu 1, button 5 clicked: disable bts. 1,3,4,6; Enable all others.
Exception: if Filter = true, enable but. 3
Got the picture?
>> Main Goal: Menu/Button Manager.
My goal here is trying to understand how "professional" software handles this kind of operations...
I mean: imagine a software like MS Word -- im sure they got some king of algorithm to handle the (huge!) button clicks, states (on/off/multi), actions, etc. otherwise it would be a "pain-in-the-ass" trying to manage menus, right?