Hi
Im not sure if the following is possible. I currently have a popup menu which can have a single optiion or many. For example I have a "Create Record" menu. In some situations (driven by data) there are many different ways to create a record so we have "create record" as a popup with the options. I have made this a segmented popup so that a click of the popup menu means a selection of the first button in the popup's tools collection.
That works well. In many situations there is only a single option and it is something generic. For example the single button tool under "Create Record" is "Create Record". I would like to make this single button invisible so that the "Create Record" popup menu looks and behaves like a button. I can get this working nicely as long as I set Visible to FALSE on the button and the button is enabled.
I have made the popup segmented so this works and stopped the dropdown arrow from doing anything with a beforetooldropdown event. How do I get rid of the popup arrow altogether? I want to be able to get rid of it in these sutuations. Is this possible with a drawfilter? Settings the dropdownarrowstyle to None seems to imply Standard and anythig other than segmented does not raise a toolclick event on the popup which I need to emulate a button.
Any help is greatly appreciated.
Thanks
Darren
Darren,
You would need a CreationFilter to remove that arrow. I have attached a very simple sample application to this forum thread which I hope will give you an idea of what you could do. Let me know if you have further questions.
Thanks.
I'll give it a try.
-Darren
Its partially working. My form is an mdi child form and it wasn't even firing at all when I attached the creation filter to the forms ultratoolbarsmanager control. I believe it probably wasn't working due to the mdi merging stuff.
As soon as I attached it to the mdiparent, I started seeing some changes. The drop down arrows have disappeared on the ribbon. They are however still there using your code on the popup menu which are attached to a grid control.
is that something that makes sense?
Is there a way of detecting what its firing for? I was looking at something which points back to the popupmenutool from the uielement but I cant find anything. I did put some messages out and I can see it firing.
When you refer to a "popup menuattached to a grid control" are you talking about a context menu? Or do you mean a dropdown list in a grid cell? Could you put together a simple sample application that I could work with so that I would know exactly what you have? These are probably different UIElements so we need to set up a different CreationFilter for this.
Its really difficult to produce a working sample that I can post without permission. I'll try and describe it all as best I can.
I have a mdi parent form called "mdiparent". This has a ribbon control. The file menu (applicationmenu2010) has 3 tools that are popupmenu tools. These tools are called mnunew, mnuopen and mnuview.
A child form is docked inside the mdiparent form as an mdi child. We are using the ultratabbedmdimanager and hence my child form appears as a tab.
The child form also has a ribbon control with an ultragrid which is docked fully. The ribbon control on this form has a popup menu called mnulist which contains 3 other popup menus called mnunew, mnuopen and mnuview. The enabled state of these tools is merged with the parent on the file menu nicely.
I have added the mnulist popup menu to the ultragrid as its context menu using setcontextmenuultra.
mnunew, mnuopen and mnuview are segmented popups. I want to get rid of the arrow in some situations and also the segmented seperator line if possible. The seperator line and the arrow need to be made invisible on the file menu of the mdi parent and also the context menu of the grid.
HTH
Hello Darren,
I started to put together a sample that includes an MDIParent/Child scenario. The arrows stay hidden with the creation filter therefore I would like for you to modify the sample to reproduce the behavior your are having issues with. Let me know if this is possible.
When you run the sample you will see a button to "Add child form", this will create a new ribbon tab that includes a PopupMenu tool.
Ive changed your example to include your popup which demonstrates my issue. Please open the child form and right-click on the ultrabutton. A popup will show wth an embedded popup menu and a button. I need to get rid of the arrow on this popup menu.
Its OK I sorted it. I was able to use getContext to retrieve the parent toolbar manager and then use activemdichildmanager to get to the toolbar on my mdi child etc.
Thanks for all your help.
Regards
That seems to work up to a point. The popup tool that gets returned from a call to getcontext seems to be a placeholder merge tool. How is it possible to get hold of the popuptool object in the mdichild. The creation filter is attached to the mdi parent and so I guess it makes sense for getcontext to return what it does?
We're nearly there but I guess I just need this bit.
If I understand your question correctly, {is there a way to get back to the original popupmenu tool from the uielement}?
I believe you can use the GetContext method to figure out when you have popupmenu and handle your custom logic. There is an example in our documentation regarding this concept.
http://help.infragistics.com/Doc/WinForms/Current/CLR4.0/?page=Infragistics4.Win.v13.2~Infragistics.Win.UIElement~GetContext(Type).html
Let me know if this helps, otherwise please clarify your request.
Thats great and now works fine. I now meed to tweak this to make it fit in with the functionality I need. I can stop the arrow from appearing but need to do this programatically. I can also see that on removal that the segmented separator also disappears which is great too.
is there a way to get back to the original popupmenu tool from the uielement. If this is possible I want to only remove the arrow uielement when there is a single button on the popup menu but not remove the arrow when multiple entries are present on the popup menu. The reason for doing this is that I want to make the popupmenu behave like a button in these rare situations where there is only a single option.The client has complained about it looking cumbersome when only one option is present.
The arrow on the popup menu is exposed from PopupMenuItemUIElement. So the hierarchy is a little different in this situation. Please modify the creation filter's if statement in the sample which should answer your question.
if (parent is ArrowUIElement && parent.Parent is PopupToolDropDownButtonUIElement || parent is ArrowUIElement && parent.Parent is PopupMenuItemUIElement) { parent.Parent.ChildElements.Remove(parent); }
Let me know if you have any questions regarding this matter.