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

Flicker when updating items in an XPMenu Bar

I have a (menu) bar at the top of my form. I update the bar by first clearing it, then adding my new (parent) bar items. I notice that when I clear the Bar.Items, the bar disappears from the form. When I add the new bar items, it reappears. This causes a noticable flicker when I need to update my menu bar. Here is the code I use: MainMenuBar.Items.Clear() MainMenuBar.Items.Add(ParentBar1) Is there a way to prevent the bar from redrawing before I finish updating? Something like: MainMenuBar.StartUpdate() MainMenuBar.Items.Clear() MainMenuBar.Items.Add(ParentBar1) MainMenuBar.FinishUpdate()

5 Replies

AD Administrator Syncfusion Team May 12, 2005 09:04 AM

Hi Carl, You could use the interop call LockWindowUpdate to pause and resume the main form repainting as shown in code below : // Pause painting LockWindowUpdate (this.Handle.ToInt64()); MainMenuBar.StartUpdate(); MainMenuBar.Items.Clear(); MainMenuBar.Items.Add(ParentBar1); MainMenuBar.FinishUpdate(); // Resume painting LockWindowUpdate (0); This should suppress any flickers that you while the main form repaints itself after the changes on it. SuspendLayout and ResumeLayout calls on the main form also might help. Please let me know if you need further assistance. Regards, Guru Patwal Syncfusion, Inc.


AD Administrator Syncfusion Team May 12, 2005 07:42 PM

I tried using LockWindowUpdate but for some reason I still get the flicker (which makes no sense to me). Currently, to avoid the flicker I''m having to insert a dummy baritem, then remove all the other baritems in the bar, then update the bar with the baritems I want, then remove the dummy baritem. This is okay for now, but it''s very sloppy. A way to suspend the redraw of the bar while I manipulate it would be much better (something like the BeginUpdate and EndUpdate on a regular TreeView).


AD Administrator Syncfusion Team May 13, 2005 04:16 AM

Hi Carl, Thanks for the update. Here is a test sample that I created for this purpose and the LockWindowUpdate seems to be correctly suppressing the flickers. Please refer to it and let me know if I am missing something. Note that the use of a short Timer (as shown in the sample) might also help. Also, we have made a few fixes in the source code to suppress the flickers in XPMenus and TabbedMDI frameworks in the recent past to address issues like defects 6, 194 and 198. These fixes will be available in the post v3.2.1.0 releases and it should take care of this issue as well. We appreciate your cooperation and thanks for your continued interest in Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.


AD Administrator Syncfusion Team May 15, 2005 07:30 PM

Thank you for your efforts Guru Patwal. Unfortunately, if I run your test code as is I still get the flicker! I''m starting to think it has something to do with my machine architecture. I''m running Windows XP Professional SP1 on a Pentium 4 2.20GHz with 1 Gb RAM. I''m running version 3.2.1.0 of Syncfusion.


AD Administrator Syncfusion Team May 17, 2005 12:47 PM

Hi Carl, I doubt it''s your machine architecture, as I''ve been able to reproduce the flicker myself. The flicker has been removed internally and the fix should be included in our next patch. Regards, Gregory Austin Syncfusion Inc.

Loader.
Live Chat Icon For mobile
Up arrow icon