I have a DropDownBarItem used as an undo menu in my application. When it drops down, I have the list of actions that can be undone. The very last item is a special baritem that is disabled. I update the text whenever the other bar items in the menu get highlighted. It displays the number of actions that will be undone (like Microsoft Word). My problem is when the number of actions goes > 10. The text of the last item was "Undoing 9 action(s)". When it becomes "Undoing 10 actions(s)", the last parentheses gets dropped. How can I force the baritem to resize when the text on it has changed?
I''m having a little trouble understanding what you''re trying to do. I have a couple questions for you:
1) Is there any reason you''re using a disabled BarItem instead of a StaticBarItem?
2) How exactly are you using the DropDownBarItem? Wouldn''t hosting BarItems in a ParentBarItem be easier?
I''ve noticed that BarItems in ParentBarItems dynamically resize, if that helps.
JKJustin KohFebruary 9, 2005 05:36 PM UTC
There is no reason. I could switch to a StaticBarItem. The reason that I''m using a DropDownBarItem is that I want to handle a click on the button (to do one undo) as well as having a drop down list of the undo items. Things will resize if I only highlight item 10, but most people scroll from item 1 - 10.
AdministratorFebruary 10, 2005 05:16 PM UTC
There''s a property in ParentBarItem that allows it to operate as a DropDown. If you set ParentStyle=DropDown then it''ll function that way.
Regarding the resize, I''m not aware of any way to force a BarItem to resize. I can think of two possible workarounds for this:
1) Include a StaticBarItem that''s wider than your BarItem needs to be. This should cause the BarItem to be drawn at a larger size as soon as the DropDown appears. A simple picture of a line would work well.
2) Instead of setting the text to "Undo 1 Item(s)", set the text to "Undo 01 Item(s)"
JKJustin KohFebruary 10, 2005 10:56 PM UTC
Thanks for your help. I actually am using a parentbaritem with the dropdown property set. I''ll try your suggestion of the static bar item later.