Click here to Skip to main content
15,889,096 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
I have created a ToolStrip and want to make it so the user can drag and drop buttons to rearrange them. I have tried setting the AllowItemReorder to true, but this requires the user to hold down the Alt key. I would prefer that this wasn't the case. But other than completely starting from scratch and programming my own routines to drag and drop using the MouseDown and MouseUp event handlers I cannot seem to find a way to do this.
Posted
Comments
JOAT-MON 14-Mar-11 17:07pm    
I would caution against this because when someone tries to click the button and their mouse is not stationary (like when they are clicking quickly), it will try to drag and may even drag far enough to drop and reorder, which could be frustrating to them. This is why there is a requirement to hold ALT key down, so the items know they are explicitly being reordered. <-- My two cents :) As far as getting the functionality, I don't think it will be there innately, but you might look at setting the ALT key programmatically to trick the control. Otherwise, I think you will be left with coding it yourself.
LordXandor 15-Mar-11 20:24pm    
I do see your point about reordering things accidentally. Although, the main issue truly is that when using the built in function to reorder the buttons it triggers my auto-hide function, thus making it impossible to see how things are being reordered. I was hoping that if there was another way of doing it, it might enable me to have more control over this triggering the auto-hide. I must admit this would be one advantage to doing it manually.
Toli Cuturicu 14-Mar-11 18:22pm    
I strongly second JOAT-MON.
What you want to do is an UI nightmare.
Don't try to invent UI conventions in Windows. It's Microsoft's job, not yours.
Your job is to follow UI conventions, not to redesign them!
If I get such software, I delete it imediatly.
LordXandor 15-Mar-11 20:29pm    
I agree with you and at the same time disagree. I'm actually creating a shell, thus Microsoft's UI conventions is kind of out the window (no pun intended). Although, I will take into consideration yall's advice, user friendlyness is certainly one of my main concerns. I think Henry's answer is the route I'm going to take.
WATYF 23-Aug-11 14:58pm    
[What you want to do is an UI nightmare. Don't try to invent UI conventions in Windows. It's Microsoft's job, not yours.]

For the record, the OP is not inventing conventions, and Microsoft already does this in toolbars.

Take the dockable toolbars available in Windows XP, for example. You can drag items around on the toolbar WITHOUT having to hold ALT (or any other key), and it works just fine. This is nothing new, nor is it anything controversial or nightmarish.

I'm trying to figure out a way to do this as well, just like the OP, because I'm looking to add dockable toolbars back into Windows now that I'm on Windows 7, which has decided to completely remove this functionality.

If I figure out how to reorder without holding ALT, I will post it here.

WATYF

1 solution

This obviously should be possible but I have never seen any code that implements it.

In case you are unable to find anything suitable, you can make the ToolStrip 'Customizable' as demonstrated here[^].
 
Share this answer
 
Comments
LordXandor 15-Mar-11 20:38pm    
This was not what I had in mind. However, this would answer multiple concerns I had for my GUI. I planned on making this 100% customizable, and I think taking this route would give the user the most power in customizing the general GUI. It would be adding a step in the process, thus almost permanently eliminating "customization on the fly," but after reading JOAT-MON and Toli Cuturicu's comments on the matter I think it would be the best course of action. I should still be able to allow items to be dragged into the toolstrip in order to add items without having to open this customization window. And this would ultimately solve the conflict with my auto-hide.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900