We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Programatically handling XPMenus, (menus performance)

Hi! We''re also experiencing bad performance with the Syncfusion menus/toolbars. Other interesting posts: http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=9862 http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=8956 In our case we''re talking ~150 baritems, ~10 bars etc and application loading time is far from good. One thing to note is that the application is heavily configured during runtime (login) and my initial idea is to check what happens if we only create/connect needed baritems. We''ve used the designer but then everything is put there and items are hidden so the sum is probably ~50-100 for an individual user. My questions: Is it possible to do multiple mainFrameBarManager.Items.AddRange ? Initially (before login) ~15 items, after login the rest (~35-50). How do I set the toolbar positions correctly without using the designer? (BarPositionInfo) Does user customization work with the multiple AddRange calls? More Qs will follow. I''ll check regarding the performance improvements in v2. Do you have any facts/figures of performance improvements to specify? The BarItems.IsValidItemID method is rather interesting and gets called a increadibly many times. And the GetNextID does a linear search.. Profile this on a form with the above number of items, 2.0.2.0 has this strange id generator. I''ll check 2.0.3.0 next week. Regards Stefan

5 Replies

AD Administrator Syncfusion Team April 9, 2004 02:55 AM UTC

Hi Stefan, 1. Yes, it is possible to do multiple mainFrameBarManager.Items.AddRange 2. For this purpose, you should first get hold of the CommandBarExt object associated with each Bar and then set its DockState property to the appropriate values to create a desired ToolBars layout (refer code snippet below) : CommandBarExt cmdbar1 = this.mainFrameBarManager1.GetBarControl(this.bar1) as CommandBarExt; cmdbar1.DockState = CommandBarDockState.Top; 3. Yes, user customization works with multiple AddRange calls. Please refer to the sample application attached here, which illustrates all my responses above. We have worked a great deal on improving the performance of our Menus package, and several improvements have been incorporated in our latest release, v2.0.3.0. Please take a look at it and let me know if you have any suggestions. We appreciate your continued interest in Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.


SL Stefan Lundberg April 21, 2004 10:32 AM UTC

Hi and thanks for the sample! ----- First I have a number of issues on the sample, please correct me if I''m wrong. 1: This call makes the cmdbar3 go away (be hidden?) line202: cmdbar3.DockState = CommandBarDockState.Right You need to toggle it from the context menu to get it visible on the right side. I''ve no clue what causes this, is it only a problem for me in my test environment? 2: Specify cmdbarN.DockState = CommandBarDockState.Bottom for all the commandbars, in the end of button2_Click. This will crash the app when docking them. (You need storeadm /remove, and ''Add Items'' first) 3: You say in the documentation not to use XPMenus and CommandBars together. In the sample CommandBar types/enums are used but maybe everything is CommandBars even in XPMenus..?? (or they share enums etc.) ----- I have modified your sample slightly to test persisted locations when bars are created later on and it seems to work as expected (ok:-). Positions from previous session are applied correct even if the bar isn''t created initially but created later when the user logs in. (I mistakenly wrote this as customization in the initial post, I meant toolbar positions but it works fine) BUT, how do initial positioning of toolbars actually work? I don''t want to design the form since we in that case create way too many bars/items but I cannot figure out how bars are lined up. In your sample they are initially (when empty) positioned on one row, fine. But when doing ''Add items'' they are split on 3 rows !?!? Note though that you have ''designed'' the sample. If I remove the (this.mainFrameBarManager1.BarPositionInfo = ) call they are positioned very ugly, several rows. How can I programmatically specify order and row of bars ''A'', ''B'', ''D'', ''F''? DockState will be Top for all of them. And regarding performance I don''t find setup/initialization performance of 2.0.3.0 better than 1.6.1 Best regards Stefan ps. Above tests/findings are done on 2.0.3.0 ds.


AD Administrator Syncfusion Team April 22, 2004 10:41 AM UTC

Hi Stefan, Thanks for the detailed update. Please see my reponses below : 1. line202: cmdbar3.DockState = CommandBarDockState.Right is to dock the CommandBar3 on the right side and not to hide it. If you are having problems seeing it, it is possibly because of the Isolated Storage that stores the customization information of the XPMenus framework. Please delete the contents of the Isolated Storage folder in the directory C:\Documents and Settings\{user name}\Local Settings\Application Data\IsolatedStorage. Re-run the sample and let me know how it goes. 2. Thanks for bringing this to our attention. I have tested for this issue by setting the following code in the button2_Click event handler. cmdbar1.DockState = CommandBarDockState.Bottom; cmdbar2.DockState = CommandBarDockState.Bottom; cmdbar3.DockState = CommandBarDockState.Bottom; cmdbar4.DockState = CommandBarDockState.Bottom; The sample crashed in v2.0.3.0 but worked fine in our latest release, v2.0.5.0. Please upgrade to the same and let me know if you continue to experience this problem. 3. The XPmenus framework is built on the CommandBars framework. Internally every XPMenus.Bar is a CommandBar. Hence it is not advisable have another set of CommandBars when you already have a XPMenus framework on the form. 4. This shortcoming has now been fixed in our latest release. Initially, the Bars are positioned on the top most row (before and after adding the BarItems). The order in which the Bars appear on the form depends on the order in which they are added to the MainFrameBarManager''s Bars collection. I am afraid, presently there is no way to explicitly specify a row for each XPMenus.Bar object. This layout has to be created at designtime. MainFrameBarManager1.BarPositionInfo is handled internally by the XPMenus framework and hence do not try to get/set this property value. Make sure that the contents of the Isolated storage folder are deleted (as outlined in 1) before you test for the above issues. Please let me know if you need further assistance. Regards, Guru Patwal Syncfusion, Inc.


SL Stefan Lundberg April 23, 2004 11:15 AM UTC

Hi, 1: Ok, this works better now. I though think it was fixed in 2.05.0 :-) 2: Ok, works fine. 4: Ok, I see that the bars now not ''jumps around'' when items are added. I''ll continue on our path but it would be good if the menus/bars package could be used without designer requirement. Pls have this as a feature request (I could open an incident if needed). It is still interesting if you comment/remove the line ''this.mainFrameBarManager1.BarPositionInfo = ''. In that case one bar is positioned on a second row.. Thank you for your support Stefan


AD Administrator Syncfusion Team April 27, 2004 04:59 PM UTC

Hi Stefan, Thanks for the update. After further investigating this, I would like to inform you that you could explicitly specify a particular row to a Bar using the CommandBarExt object associated with it as follows : CommandBarExt cmdbar1 = this.mainFrameBarManager1.GetBarControl(this.bar1) as CommandBarExt; cmdbar1.RowIndex = 0; I have modified my above sample to illustrate this, and have attached it here. Run the sample and click the "Add BarItems" button to populate the Bars. Now click the "SetRowIndex" button to programmatically arrange the layout of the Bars. Please refer to the sample and let me know if this meets your requirements. Make sure that the contents of the Isolated Storage directory are empty before you do the above test. We appreciate your continued interest in Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.

Loader.
Up arrow icon