Print Page | Close Window

statusbar stops responding

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=10737
Printed Date: 16 July 2025 at 4:24am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: statusbar stops responding
Posted By: leojay
Subject: statusbar stops responding
Date Posted: 22 May 2008 at 5:03am
i'm using c#.
in a very simple project, i just add a statusbar in the main form like this:
private const int MIN_VALUE = 0;
private const int MAX_VALUE = 300;
private const int DEFAULT_VALUE = 100;


public void SliderPaneClick(XtremeCommandBars.StatusBarSliderPane pane,
                            XtremeCommandBars.XTPSliderCommand command,
                            int pos)
{
    System.Diagnostics.Debug.WriteLine(string.Format("cmd: {0}, pos: {1}, pane: {2}", command.ToString(), pos, pane.ToString()));

    int newvalue = pos;

    switch (command)
    {
        case XtremeCommandBars.XTPSliderCommand.XTP_SB_LEFT:
            newvalue = MIN_VALUE;
            break;
        case XtremeCommandBars.XTPSliderCommand.XTP_SB_RIGHT:
            newvalue = MAX_VALUE;
            break;
        case XtremeCommandBars.XTPSliderCommand.XTP_SB_LINELEFT:
            newvalue = Math.Max(MIN_VALUE, pane.Value - 10);
            break;
        case XtremeCommandBars.XTPSliderCommand.XTP_SB_LINERIGHT:
            newvalue = Math.Min(MAX_VALUE, pane.Value + 10);
            break;
        case XtremeCommandBars.XTPSliderCommand.XTP_SB_THUMBTRACK:
            newvalue = pos;
            break;
        case XtremeCommandBars.XTPSliderCommand.XTP_SB_PAGELEFT:
            newvalue = Math.Max(MIN_VALUE, pane.Value - 30);
            break;
        case XtremeCommandBars.XTPSliderCommand.XTP_SB_PAGERIGHT:
            newvalue = Math.Min(MAX_VALUE, pane.Value + 30);
            break;
        default:
            System.Diagnostics.Debug.WriteLine(
                string.Format("strange value: cmd: {0}, pos: {1}", command.ToString(), pos));
            return;
    }

    if (newvalue != pane.Value)
    {
        pane.Value = newvalue;
        CommandBars.StatusBar.FindPane(1).Text = newvalue + "%";
    }
}

private void Form1_Load(object sender, EventArgs e)
{
    XtremeCommandBars.StatusBar sb = CommandBars.StatusBar;
    sb.AddPane(0);

    XtremeCommandBars.StatusBarPane p = sb.AddPane(1);
    p.Width = 40;
    p.Alignment = XtremeCommandBars.XTPTextAlignment.xtpAlignmentRight;
    p.Text = DEFAULT_VALUE + "%";

    XtremeCommandBars.StatusBarSliderPane slider = sb.AddSliderPane(2);
    slider.Min = MIN_VALUE;
    slider.Max = MAX_VALUE;
    slider.Value = DEFAULT_VALUE;
    slider.Width = 150;
    slider.SetTicks(DEFAULT_VALUE);
    sb.SliderPaneClick += SliderPaneClick;
    sb.Visible = true;

}


if i press the thumb of the slider, and drag it left and right for about one minute, the slider will stop responding any events.

you can get my project and screenshot here:
http://python.leojay.googlepages.com/sbtest.zip

btw, another strange thing is in the SliderPaneClick function,  the value of parameter command could be 8 which does not exist in the definition of XtremeCommandBars.XTPSliderCommand.





Replies:
Posted By: Oleg
Date Posted: 22 May 2008 at 8:55am
its .NET - you never know when object will be destroyed.  :) So just move StatusBar declaration to variables of Form:
 

XtremeCommandBars.StatusBar sb;

private void Form1_Load(object sender, EventArgs e)

{

sb = CommandBars.StatusBar;

....


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: leojay
Date Posted: 22 May 2008 at 9:44pm
thanks, it works.

but i'm still not convinced by your explanation. how could the statusbar be GCed, when it's still referenced by "CommandBars"?


Posted By: Oleg
Date Posted: 23 May 2008 at 1:30am
Hello,
 
Its ActiveX control.  line
XtremeCommandBars.StatusBar sb = CommandBars.StatusBar;
 
creates temporary object sb that become wrapper of StatusBar COM Object. it will be destroyed after method leave scope and Garbage collection decide to clean dead objects.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: leojay
Date Posted: 23 May 2008 at 4:09pm
thanks.

in the SliderPaneClick function,  the value of parameter command could be 8 which does not exist in the definition of XtremeCommandBars.XTPSliderCommand. what's the meaning of 8?


Posted By: Oleg
Date Posted: 24 May 2008 at 12:46pm
HI,
 
We added XTP_SB_ENDSCROLL for next release - fired when user release mouse after scroll.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net