BarButton is not refreshed

Docking/MDI for Windows Forms Forum

Posted 16 years ago by BLANC Stéphane - Staubli Robotics Suite Product Manager, STAUBLI
Version: 2.0.0105
Avatar
Hi,

I have a really weird behavior with a custom BarButton.
In the UpdateState (that is called by my barManager) I update the "checked" property but the button isn't redrawn.
In order to view the new state (checked or not) I need to put the cursor of the mouse over the button...

Any idea to solve my problem ?

Thanks for your help

Regards

Stéphane

    public class ToggleShowAnalogicCardsCommand : BarButtonCommand
    {
        public ToggleShowAnalogicCardsCommand(string x_name, string x_text, int x_imageIndex) : base(x_name, x_text, x_imageIndex)
        {
            this.Checked = true;
        }

        public override void ResetCheckable()
        {
            this.Checkable = true;
        }

        public override void UpdateState(BarCommandLinkEventArgs x_e)
        {
            this.Checked = this.physicalIoView.showAnalogicCards;
            x_e.Handled = true;
        }

        protected override void OnClick(BarCommandLinkEventArgs x_e)
        {
            this.physicalIoView.showAnalogicCards = !this.physicalIoView.showAnalogicCards;
            x_e.Handled = true;
        }
    }

Comments (2)

Posted 16 years ago by BLANC Stéphane - Staubli Robotics Suite Product Manager, STAUBLI
Avatar
If I manually call the .Invalidate it works fine but I don't understand why I have to do that...

        public override void UpdateState(BarCommandLinkEventArgs x_e)
        {
            if (x_e.CommandLink != null)
            {
                this.Checked = this.physicalIoView.showAnalogicCards;
                x_e.CommandLink.BarControl.Invalidate(ActiproSoftware.WinUICore.InvalidationLevels.Element, ActiproSoftware.WinUICore.InvalidationTypes.Paint);
            }
            x_e.Handled = true;
        }
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Stéphane,

There is code in the Checked property setter to repaint related links. So it should be working.

If you think there is a problem, please put together a simple sample project that shows the issue and e-mail it over to our support address. Thanks!


Actipro Software Support

The latest build of this product (v25.1.0) was released 25 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.