dropdown usercontrol

Bars for Windows Forms Forum

Posted 17 years ago by Maurizio Margiotta - Lead Programmer, Evolution City Group S.a.s.
Version: 2.0.77
Avatar
Hi,

I have studied all the documentation and I find that UIStudio looks really grate e full of powerful functionalities.

But I have not found a way to display a user control in a dropdown button on the toolbar, like a color picker of Microsoft Word.

Is it possible to do it some way? What type of CommandLink I should use?

Best regards,

Maurizio

Comments (7)

Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi there... you'd have to embed a custom control in a BarCustomControlCommand and create a link for it from that. If you'd like, email us and we can send you some sample code that we used to build a custom control command that has a date/time picker control.


Actipro Software Support

Posted 17 years ago by Maurizio Margiotta - Lead Programmer, Evolution City Group S.a.s.
Avatar
Ok, I have taken a look to the sample, and it is a good think that I can insert a new control inside bars and menu.

But I have some questions and notes:
1) After that I insert my new command and command link inside InitilizeComponent I can manage it at design time, but there are some problems with the Customize window: when I open it, I can't make the menu bar to show, until I change tab inside the Customize window. I'm not sure if it happen either with standard commands.

2) It's not so easy to change manually the code inside InitializeComponent. So if the needing is not to create a custom command link from scratch, but it's only to show a custom control inside a dropdown window, it could be much more easy to use a standard command that draws itself regularly like any others (icon, text and little arrow) and that shows and empty dropdown.
So I could assign a Control object to it, from which I will call some method of the command to update the value, to make it close and to raise the CommandClick event.
In this way I could insert this type of commands and links directly in design mode.

3) I don't understand why the Command have the width property. I was thinking that "A command does NOT have a user interface", like is written inside the documentation. So it should not have graphic properties. In fact, I can't set two different links with different width. Have I misunderstood something?

Ok, I finish... I hope you will find the time to answer to so many questions. :-P

Thanks,

Maurizio
Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Maurizio,

1) Can you send over a small project that shows this issue?

2) Once you add the command to the BarManager in InitializeComponent, you should be able to open your Form, open the Customize window and then drag your command from the Customize window to create a link where needed.

3) The command itself doesn't have a width, but that is passed along to all the command links that share it so that they know what width they need to be.


Actipro Software Support

Posted 17 years ago by Maurizio Margiotta - Lead Programmer, Evolution City Group S.a.s.
Avatar
1) I have used your sample "Bar Controls". To reproduce it open the form and enter in customization mode; select the "Commands" tab, and then the "Menu Bar" from the list. Now click everywhere on the menu bar or on the tool bars. Very often I can't do anything until I click somewhere on Customize window. I'm using the trial 2.0.0077.

2)Yes I can but I have notice a little problem at Design Time:
If I put the BarDateTimePickerCommandLink inside a menu, for example at the end of the Edit menu, the DataTimeControl is not visible and an empty row is added.
If I put the BarDateTimePickerCommandLink on a toolbar, it let 200 pixels empty, and when I close customization it disappears completely.
If I put the BarDateTimePickerCommandLink directly on Menu Bar, not inside a popup button, the DateTimePicker is always visible, but during customization I can't select and edit it.

Any way, on point 2 I didn't mean that. Sorry for my English, I have some difficult to explain...
I was telling that it could be useful to have something like a BarDropDownButton that acts like a BarPopupButton and/or a BarSplitButton, so that I could create it ad Design Time.
The differences with them will be that I could assign to it a Control by code, to be shown when I open the popup window.

An example is here: sample
Like you see there is a color picker inside a popup window, but I could insert anything I want.
If would extend a BarCustomControlCommandLink to do that, I should recreate all the same features of a BarPopupButtonLink, like icon, text ecc...

I hope that I was more clear now

Thank you.
Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Maurizio,

I am testing like this... I install the evaluation, copy the date/time picker example into the project, open BarForm's code, add the BarDateTimePickerCommand to the BarManager.Commands in InitializeComponent, recompile the code, then open it in the designer.

At that point, I see the command in the list and am able to drag/drop it different places. For my test, I added it to a dockable toolbar and a menu. Note that the control might not show up in the designer (will appear as space) but it will at runtime. If I save the form, close and reopen, the command links are there.

If I run the form, both instances are visible. Now to the runtime customization issue. A problem with using custom controls is that they intercept mouse messages before we can see them. So right clicks and drag of the custom control link might not register. One workaround might be to switch on a mode in your control when in Customize mode via a Windows message procedure that tells Windows that the control is transparent. That way mouse messages will filter back to where they should go. Also, adding padding and/or labels will give you a place where mouse messages can register without doing the suggestion above.


Actipro Software Support

Posted 17 years ago by Maurizio Margiotta - Lead Programmer, Evolution City Group S.a.s.
Avatar
Thank you for your answer.
Good suggestion to add labels near a custom control.

But what about the idea of a BarDropDownButton?
Do you think that can already be done in other way using existing commands?
Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Actually I think you can do that right now. If you make a popup command, add an expander to its DefaultCommandLinks. Then at run-time you can determine what links fill the expander when the popup's menu is displayed. That way you can add your own custom links dynamically.


Actipro Software Support

The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.