Print Page | Close Window

Not getting PaneClick event?

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=16621
Printed Date: 27 November 2024 at 2:42pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Not getting PaneClick event?
Posted By: blazej
Subject: Not getting PaneClick event?
Date Posted: 22 April 2010 at 3:03pm
Hi,

I'm adding a pane to my status bar:

StatusBarPane myPane = _commandBars.StatusBar.AddPane( MY_ID );
myPane.IconIndex = MY_ID_ICON;
myPane.Button = true;
_commandBars.StatusBar.PaneClick += new IStatusBarEvents_PaneClickEventHandler( OnStatusBarPaneClick );

And then I have:

void OnStatusBarPaneClick( StatusBarPane pane )
{
    pane.Checked = !pane.Checked;
}

The pane gets added and all, but I never get the PaneClick event...

I'm using C#, .NET 2.0, VS 2008, CommandBars v 13.1, Win XP 64 bit but my app is 32 bit.

Best,
Michal



Replies:
Posted By: blazej
Date Posted: 28 April 2010 at 2:56pm
Seriously, no one is going to answer this question?

So why exactly have we renewed our license recently???

Best,
Michal


Posted By: Aaron
Date Posted: 28 April 2010 at 4:41pm
Hi,
 
I'm not familiar with C# but I looked at a sample (C# StatusBar sample)
 
StatusBar = CommandBars.StatusBar;     //using Commandbars statusbar?
StatusBar.PaneClick += new XtremeCommandBars.IStatusBarEvents_PaneClickEventHandler(this.StatusBar_PaneClickEvent);
 
private void StatusBar_PaneClickEvent(XtremeCommandBars.StatusBarPane e)

{

.....}
 
 
I'm also disappointed that no one replied on this, looks like an easy question (if you are using C#)  You better look at the StatusBar sample that comes with the install
 
 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....


Posted By: blazej
Date Posted: 28 April 2010 at 7:31pm
Yeah, actually I tried it again, and it works. The only thing I changed, I think, was the ID of the pane...

Anyway, thanks Aaron!

Michal


Posted By: blazej
Date Posted: 04 May 2010 at 10:12pm
Hi again,

Actually, it still doesn't work. I get the event immediately after the application loads, but once I load some data, the event stops being fired. I've searched through my code, but the only thing the action of loading data does is to change the text of another status bar pane. Even if I comment out the code that changes the text, the event still does not get fired.

Help, anyone? What could be causing the event to stop firing?

Michal


Posted By: SuperMario
Date Posted: 05 May 2010 at 12:58pm
If this is MDI, be sure you do this:

            foreach (Control ctrl in this.Controls)
            {
                if (ctrl is MdiClient)
                {                                                                       
                    CommandBars.SetMDIClient(ctrl.Handle.ToInt32());
                }
            }

Then add status bar:

public XtremeCommandBars.StatusBar StatusBar;

            StatusBar = CommandBars.StatusBar;
            StatusBar.PaneClick += new XtremeCommandBars.IStatusBarEvents_PaneClickEventHandler(this.StatusBar_PaneClickEvent);
            StatusBar.PaneDblClick += new XtremeCommandBars.IStatusBarEvents_PaneDblClickEventHandler(this.StatusBar_PaneDblClickEvent);
            StatusBar.MouseDown += new XtremeCommandBars.IStatusBarEvents_MouseDownEventHandler(this.StatusBar_MouseDownEvent);
            CommandBars.StatusBar.Visible = true;

Then add some pane:

            XtremeCommandBars.StatusBarPane Pane;

            Pane = StatusBar.AddPane(0);
            Pane.Style = XtremeCommandBars.XTPStatusPaneStyle.SBPS_STRETCH | XtremeCommandBars.XTPStatusPaneStyle.SBPS_NOBORDERS;
            Pane.Text = "Ready";
            Pane.Width = 0; //Auto Size

        private void StatusBar_PaneClickEvent(XtremeCommandBars.StatusBarPane e)
        {
            System.Diagnostics.Debug.WriteLine ("PaneClick. Id = " + e.Id);
        }

.......................


Posted By: blazej
Date Posted: 05 May 2010 at 1:10pm
Hi,

No, it's not MDI. We are using DockingPane with a single document window (and many additional panes). Also, we load the command bars like this:

_commandBars.LoadDesignerBars( null, null );

Best,
Michal


Posted By: SuperMario
Date Posted: 05 May 2010 at 1:46pm
DesignerBars should make no difference, so you have all the code I posted in that same order, except the for each?

Do you have this set after you add your status bar?  Do you create the panes after the commandbars?

DockingPaneManager.SetCommandBars (CommandBars.GetDispatch());  


Posted By: blazej
Date Posted: 05 May 2010 at 2:03pm
My order is different:

_commandBars.LoadDesignerBars( null, null );
_commandBars.StatusBar.Visible = true;
_commandBars.StatusBar.AddPane( 0 );
_commandBars.StatusBar.PaneClick += OnStatusBarPaneClick;

If I move the event assignment up (before setting Visible) it is even worse, i.e. the event doesn't get fired even before a document is loaded.

My panes are created and initialized AFTER the bars.

Best,
Michal



Posted By: SuperMario
Date Posted: 05 May 2010 at 2:48pm
Please add code exactly as I put in previous threads and in this order:

public XtremeCommandBars.StatusBar StatusBar;

_CommandBars.LoadDesignerBars( null, null );

StatusBar = _CommandBars.StatusBar;
StatusBar.PaneClick += new XtremeCommandBars.IStatusBarEvents_PaneClickEventHandler(this.StatusBar_PaneClickEvent);
_CommandBars.StatusBar.Visible = true;

XtremeCommandBars.StatusBarPane Pane;
Pane = _commandBars.StatusBar.AddPane( 0 );

        private void StatusBar_PaneClickEvent(XtremeCommandBars.StatusBarPane e)
        {
            System.Diagnostics.Debug.WriteLine ("PaneClick. Id = " + e.Id);
        }




Posted By: blazej
Date Posted: 05 May 2010 at 3:01pm
No luck.

Here's my code:

            _commandBars.LoadDesignerBars( null, null );

            // Status bar setup.
            StatusBar statusBar = _commandBars.StatusBar;
            statusBar.PaneClick += OnStatusBarPaneClick;
            statusBar.Visible = true;

            statusBar.AddPane( 0 );

            StatusBarPane pane = statusBar.AddPane( ID.PANE_DATA_TYPE );
            pane.Width = mainForm.StatusBarInfoPaneWidth;
            pane.Alignment = XTPTextAlignment.xtpAlignmentRight;
            pane.Text = string.Empty;

            statusBar.AddPane( ID.PANE_INDICATOR_CAPS );
            statusBar.AddPane( ID.PANE_INDICATOR_NUM );
            statusBar.AddPane( ID.PANE_INDICATOR_SCRL );

            StatusBarPane plotCreationPane = statusBar.AddPane( ID.PANE_DEBUG_PLOT_CREATION );
            plotCreationPane.IconIndex = ID.CMD_DEBUG_PLOT_CREATION;
            plotCreationPane.Button = true;
            StatusBarPane dumpBeforePane = statusBar.AddPane( ID.PANE_DEBUG_DUMP_BEFORE );
            dumpBeforePane.IconIndex = ID.CMD_DEBUG_DUMP_BEFORE;
            dumpBeforePane.Button = true;
            StatusBarPane dumpAfterPane = statusBar.AddPane( ID.PANE_DEBUG_DUMP_AFTER );
            dumpAfterPane.IconIndex = ID.CMD_DEBUG_DUMP_AFTER;
            dumpAfterPane.Button = true;

            SetChecked( ID.CMD_VIEW_STATUS_BAR, true );
            SetChecked( ID.CMD_VIEW_TOOLBAR, true );

            commandBars.GlobalSettings.App = mainForm;

And then:

        void OnStatusBarPaneClick( StatusBarPane pane )
        {
            pane.Checked = !pane.Checked;

            if( pane.Id == ID.PANE_DEBUG_PLOT_CREATION )
            {
               // ...
            }
        }


Posted By: SuperMario
Date Posted: 05 May 2010 at 3:34pm
Actually, that still isn't my code ;)

Notice where I declare Statusbar....I assumed the Public keyword would have given that away.  You are re-declaring locally so it can't work.

    public class frmMain : System.Windows.Forms.Form
    {
        public AxXtremeCommandBars.AxCommandBars CommandBars;
        private AxXtremeCommandBars.AxImageManager ImageManager;
        static public frmMain Instance;
        public XtremeCommandBars.StatusBar StatusBar;

......

Also the pane click handler is not as I wrote:

StatusBar.PaneClick += new XtremeCommandBars.IStatusBarEvents_PaneClickEventHandler(this.StatusBar_PaneClickEvent);

If you can't figure it out just attach the project and I'll fix it for you.


Posted By: blazej
Date Posted: 05 May 2010 at 3:47pm
Hi,

StatusBar.PaneClick += new XtremeCommandBars.IStatusBarEvents_PaneClickEventHandler(this.StatusBar_PaneClickEvent);

and

StatusBar.PaneClick += StatusBar_PaneClickEvent;

are the same in C#.

But the trick with using a class member instead of a local variable worked! Can you explain this to me? Normally it should matter at all if it is one or the other... But maybe OCX are special...

Best,
Michal



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