Hello,
Is there a way to prevent the below from showing if a form size is changed so that the tools do not fit on the screen?
The secondary issue to this is that users can edit values in the toolbars. There is an operation after which updates other values in the toolbar. This update operation is in a background worker. If the user makes the screen small enough so that any of the toolbar items are not visible which updates blows up the toolbar manager and we see this:
If it is not an easy solution is there a way to know that the toolbar is not showing completely? Maybe we can prevent the tool from going into edit mode?
Thanks,
M.
Hello Michael,
I have been investigating into the behavior you are seeing, and at the moment, it does not appear that there is a publicly exposed property that will hide the “QuickCustomizeTool” to the right side of the UltraToolbarsManager when the toolbar is not wide enough to show all tools. There also does not exist anything public that can tell you when a tool has been “bumped” into this menu. That said, there are ways to hide this menu, as well as some non-public properties that you can use reflection to obtain the values of that can give you this information.
In order to prevent this menu from showing up, I would recommend creating a class deriving from IUIElementCreationFilter that you will use with the UltraToolbarsManager.CreationFilter property. In that interface’s BeforeCreateChildElements method, you can check if the UIElement parameter is a QuickCustomizeToolUIElement, and if so, return true. Else, return false. This will remove the menu.
If you would like to see if a particular tool is “bumped” from the toolbar, I would recommend using reflection to get the internal “BumpedFromToolbar” property. This property determines whether or not the tool would show in the QuickCustomizeTool to the left, and if any tool returns “true” for the value of this property, it can be assumed that the menu would normally be shown.
I am attaching a sample project demonstrating the CreationFilter as well as the reflective method to get the “BumpedFromToolbar” property.
Regarding the red-X that you are receiving, I have to imagine this is very likely due to something relating to the background worker, but without an error message, stack-trace or reproducible sample project, I am unsure as to what at the moment. Are you receiving any sort of error message when you receive this red X?
Please let me know if you have any other questions or concerns on this matter.
ToolbarItemsCutOffTest.zip
Thank you for taking the time to look at this. This is why I use your product, excellent communication.
Here is the stack trace...let me know what you think. I will look at implementing your idea.
" at Infragistics.Win.UltraWinToolbars.UltraToolbarBase.ToolbarMetrics.CalculateFloatingMetricsHelper(ToolGroup[] toolGroups, Int32 maxWidth)\r\n at Infragistics.Win.UltraWinToolbars.UltraToolbarBase.ToolbarMetrics.CalculateFloatingMetrics(Size cachedSize, Size delta)\r\n at Infragistics.Win.UltraWinToolbars.UltraToolbarBase.GetMetrics(Size cachedSize, Size delta)\r\n at Infragistics.Win.UltraWinToolbars.UltraToolbarBase.ToolAreaInformation.FromToolbar(UltraToolbarBase toolbar, Rectangle overallArea)\r\n at Infragistics.Win.UltraWinToolbars.ToolbarUIElement.PositionChildElements()\r\n at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)\r\n at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)\r\n at Infragistics.Win.UIElement.DrawHelper(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Boolean clipText, Boolean forceDrawAsFocused, Boolean preventAlphaBlendGraphics, Nullable`1 zoomFactor)\r\n at Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Size elementSize, Boolean preventAlphaBlendGraphics)\r\n at Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode)\r\n at Infragistics.Win.UltraControlBase.OnPaint(PaintEventArgs pe)\r\n at Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea.OnPaint(PaintEventArgs pe)\r\n at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)\r\n at System.Windows.Forms.Control.WmPaint(Message& m)\r\n at System.Windows.Forms.Control.WndProc(Message& m)\r\n at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)\r\n at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)\r\n at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)"
Thank you for the stack trace, but unfortunately at the moment, I cannot be certain on what the issue is from it. As such, I have a couple of questions for you on this matter. Can you please answer the below?
1. What is the actual type of exception you are seeing in this case (e.g. NullReferenceException, InvalidOperationException, etc.)?
2. As a test, if you carry out the behaviors in your background worker synchronously instead, does the same error occur?
3. Are you able to provide a sample project or potentially modify the one I sent you such that it reproduces the behavior you are seeing?
4. What specific version of Infragistics for Windows Forms are you using?
Thank you for your update on this matter.
I will continue to investigate into our source code with the Null Reference Exception, and I will continue to monitor this forum thread awaiting your answers to points 2 and 3.
Thanks. I am on the road the next few days so I won't have full answers until Monday.
1. Object not set to a reference
2. WIll test
3. Will work on this
4. 19.1.20191.82