|
Either disable the items (they remain visible, readable, but are not selectable)
or remove them temporarily, by taking them out their regular collection and keeping
them in another collection, not associated with any live menu.
|
|
|
|
|
Either disable the items (they remain visible, readable, but are not selectable)
In this case are are 50 disabled items in menu different menus. This looks ugly to user. So it is not possible.
or remove them temporarily, by taking them out their regular collection and keeping
them in another collection, not associated with any live menu.
I shoudl also member menu item position in menu tree system and placement. Where to find sample code which implements this ?
Andrus
|
|
|
|
|
I have no sample code.
You could work the other way around:
- use Designer to design the maximally populated menus;
- then programmatically remove them in globo from the main menu structure, but keeping
them around;
- and provide the appropriate subset by copying the items you want to keep into
the main menu structure again.
That way you always know what the exact population and order of the original menus was
and you can easily create any subset you want.
|
|
|
|
|
- use Designer to design the maximally populated menus;
Done.
then programmatically remove them in globo from the main menu structure, but keeping
them around
I tried in main form load
ToolStripItemCollection Copy = MainMenuStrip.Items.Clone();
but got compile error
'System.Windows.Forms.ToolStripItemCollection' does not contain a definition for 'Clone' and no extension method 'Clone' accepting a first argument of type 'System.Windows.Forms.ToolStripItemCollection' could be found (are you missing a using directive or an assembly reference?)
Andrus
|
|
|
|
|
I haven't done this with ToolStripItems yet.
There seems to be a CopyTo() that may be useful.
|
|
|
|
|
CopyTo() copies only top level menu items. Child items are not copied. So child items are destroyed i sLoad and not restored if new user logs in
How to clone whole menu tree ?
partial class MainForm : Form {
ToolStripItem[] Copy;
protected override void OnLoad(EventArgs e) {
Copy = new ToolStripItem[MainMenuStrip.Items.Count];
MainMenuStrip.Items.CopyTo(Copy, 0);
SetVisibility(MainMenuStrip.Items);
}
void NewUser_Click(object sender, EventArgs e) {
MainMenuStrip.Items.Clear();
MainMenuStrip.Items.AddRange(Copy);
Copy = new ToolStripItem[MainMenuStrip.Items.Count];
MainMenuStrip.Items.CopyTo(Copy, 0);
SetVisibility(MainMenuStrip.Items);
}
void SetVisibility(ToolStripItemCollection items)
{
foreach (ToolStripItem item in new IsolatorCollection(items))
{
if (item.Tag != null)
if ( CurrentUserShoundNotSeeThis(item.Tag))
items.Remove(item);
ToolStripDropDownItem dropItem = item as ToolStripDropDownItem;
if (dropItem != null)
SetVisibility(dropItem.DropDownItems);
}
}
Andrus
|
|
|
|
|
BTW: just hiding items (Visible=false) is wrong anyway, what will happen to the
shortcuts (CTRL/C and the like) that got assigned to you items?
I set both Visible and Enabled to false. In this case shortcuts are disabled also.
Andrus
|
|
|
|
|
first of all i would like to say that i am very new to programming and also to .net .
now i have a problem.
i have two dropdownlists:
1) dropdownlist 1- having 2 items ex: male and female
2) dropdownlist 2_ having 4 items ex: dog, cat, fish, cow.
now the problem is :
if i select male then all the four options should be visible , but if i select female then dog, cat and cow will be visible but not fish.
please send me the code both by help if items are hardcoded by itemlist and if we want to manipulate through database(sqlserver 2000).
please help me , and reply me fast.
thank you
|
|
|
|
|
As fast as I could, it might not compile tho...
HAI
CAN HAS STDIO?
I HAS A dropdown1 ITZ ARRAY
I HAS A dropdown2 ITZ ARRAY
BTW array assignments
LOL dog IN MAH dropdown2
LOL cat IN MAH dropdown2
LOL cow IN MAH dropdown2
I HAS A gender IN MAH dropdown1 ITZ YARN
GIMMEH gender
IZ gender LIEK "male"?
YARLY
BTW the male case
LOL fish IN MAH dropdown2
NOWAI
BTW the female case, no other assignment necessary
KTHX
KTHXBYE
“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.”
-Edsger Dijkstra
|
|
|
|
|
if(Listbox1.Text=="Female")
{
Listbox2.Items.Clear();
ListBox2.Items.Add("dog");
ListBox2.Items.Add("cat");
ListBox2.Items.Add("cow");
}
else if(Listbox1.Text=="Male")
{
Listbox2.Items.Clear();
ListBox2.Items.Add("dog");
ListBox2.Items.Add("cat");
ListBox2.Items.Add("fish");
ListBox2.Items.Add("cow");
}
|
|
|
|
|
Is there a way to modify the start menu to add a new "expandable button" under 'all programs'. This expandable button would function like the "all programs" button but when it shows the list of programs, it will only display the applications relevant to the user's job. I've searched around but i can't find anything.
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
|
The link you provided has nothing to do w/ my question. I really don't care how to change the text on the start button. And besides, nothing is impossible! This link[^] shows how to add buttons/groups to the taskbar. I am already able to get a handle to the window in which i believe the "All Programs" button is added. I am just not sure which messages to send to get a button created.
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
You might tell us for which operating system you want this?
|
|
|
|
|
Hi Luc, the OS is Windows XP. Playing around with Spy++ i am able to get a handle to the window (i think it's "Desktop More Programs Pane") which the button might be added. I tried to get a handle to the window that gets expanded, but i haven't had much luck. If you'd like more information please let me know!
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
Users who use the "Classic Start Menu" (as I do) don't have an "All Programs" button.
But accomplishing what you want is as simple as adding a directory to
C:\Documents and Settings\userxxxx\Start Menu
Then add the appropriate shortcuts.
|
|
|
|
|
I'm not so sure about that.
Seems to me the "All Programs" list is an aggregation of several lists, the
current user's "Start Menu" being just one of them.
|
|
|
|
|
I tested this using the "Classic Start Menu". I dragged a shortcut to the directory you provided and all it did was add it to the top of the start menu. This isn't the desired result. What i'm looking for is to create my own root "Menu Item" (exactly like "Programs" in the classic menu except i want to name it something like 'my company') and when that menu item is hovered over, it will list all the programs (that i build programatically) for that employee to use.
I've seen the start menu modified before. ex: Like when you buy a dell computer and use their system restore disks ; I've seen buttons on the start menu that say "Dell support", etc. Moreover, I've seen HP computers that have their own "HP Help" button right under the Windows help button.
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
Other than being above the separator (and a different icon), it is exactly like the Programs submenu.
And it's the "proper" way to do it.
teejayem wrote: start menu modified before. ex:
That's part of why I wipe the hard drives of new computers; to get rid of such non-standard crap.
|
|
|
|
|
I don't bother modifying the Windows generated lists, I simply create my own lists,
but I don't show them in the Start menu.
When your task bar is not locked, you can create new toolbars, using the task bars
context menu. Create and choose an arbitrary folder, give it a simple name and load it
with the shortcuts you want. It will show up next to the notification area.
AFAIK this works on all versions of XP and Vista, and I expect it to work on older and
future versions too.
|
|
|
|
|
Hi Luc, Thanks for the reply. This certainly is a possibility (pending that i am not able to modify the start menu). The project that this is for is for the call center for my company. So i need to be able to guarantee a few things:
1. I need to be able to monitor the process's that are executed (before, i had my own "start menu" replica, and when someone clicked to start a program i would use System.Diagnostics.Process to execute the application and get the processID, MainWindowHandle).
2. I need to ensure that the toolbar on the taskbar can be visible (w/o rightclicking on the taskbar and click "new toolbar") programmatically.
3. I need to be able to dynamically create the list of folders/files depending on the user access (that information is stored in a database)
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
Hi,
2. you could do that once, manually. And I guess there is a way to do it
programmatically, but I don't know right now.
3. no problem, the new toolbar in the end is just a folder somewhere, you can
create/delete shortcuts in there programmatically.
|
|
|
|
|
Windows uses 'special folders' that go in the start menu. These are stored in the registry under HKEY_CLASSES_ROOT\CLSID - you should be able to create your own. The items in the start menu are stored in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartMenu and StartPanel.
I've never tried altering these myself but it might be a start?
Dave
|
|
|
|
|
I need to show the shipping information for each customer. Project summary : Customers are to login in with their customer ID and password. After logged in, I display a gridview with the invoice date, shipped by and tracking number.
The main query is as followed
<asp:accessdatasource id="adfedex" runat="server" datafile="~/App_Data/Tracking.mdb" xmlns:asp="#unknown"><br />
SelectCommand="SELECT SalesID AS [Sales ID], TrackingNumber AS [Fedex Tracking], InvoiceCreateDate AS [Invoice Date] FROM TrackingData WHERE ShipVia LIKE 'f%' ORDER BY InvoiceCreateDate DESC";<br />
</asp:accessdatasource>;
How do I show for the current logged on user only? Keep in mind the username is the same as the customerid.
Thanks for any help
|
|
|
|
|
u already there with
Denise_SQL_DBA wrote: WHERE ShipVia LIKE
add:
AND customerid[from DB] = customerid[user input]
Have Fun
Never forget it
|
|
|
|