Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Not getting PaneClick event?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Not getting PaneClick event?

 Post Reply Post Reply
Author
Message
blazej View Drop Down
Groupie
Groupie


Joined: 09 February 2005
Location: Canada
Status: Offline
Points: 53
Post Options Post Options   Thanks (0) Thanks(0)   Quote blazej Quote  Post ReplyReply Direct Link To This Post Topic: Not getting PaneClick event?
    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
Back to Top
blazej View Drop Down
Groupie
Groupie


Joined: 09 February 2005
Location: Canada
Status: Offline
Points: 53
Post Options Post Options   Thanks (0) Thanks(0)   Quote blazej Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post 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....
Back to Top
blazej View Drop Down
Groupie
Groupie


Joined: 09 February 2005
Location: Canada
Status: Offline
Points: 53
Post Options Post Options   Thanks (0) Thanks(0)   Quote blazej Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
blazej View Drop Down
Groupie
Groupie


Joined: 09 February 2005
Location: Canada
Status: Offline
Points: 53
Post Options Post Options   Thanks (0) Thanks(0)   Quote blazej Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post 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);
        }

.......................
Back to Top
blazej View Drop Down
Groupie
Groupie


Joined: 09 February 2005
Location: Canada
Status: Offline
Points: 53
Post Options Post Options   Thanks (0) Thanks(0)   Quote blazej Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post 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());  
Back to Top
blazej View Drop Down
Groupie
Groupie


Joined: 09 February 2005
Location: Canada
Status: Offline
Points: 53
Post Options Post Options   Thanks (0) Thanks(0)   Quote blazej Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post 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);
        }


Back to Top
blazej View Drop Down
Groupie
Groupie


Joined: 09 February 2005
Location: Canada
Status: Offline
Points: 53
Post Options Post Options   Thanks (0) Thanks(0)   Quote blazej Quote  Post ReplyReply Direct Link To This Post 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 )
            {
               // ...
            }
        }
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
blazej View Drop Down
Groupie
Groupie


Joined: 09 February 2005
Location: Canada
Status: Offline
Points: 53
Post Options Post Options   Thanks (0) Thanks(0)   Quote blazej Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.188 seconds.