Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - [QUESTION] StatusBar and multiple Commandbars
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[QUESTION] StatusBar and multiple Commandbars

 Post Reply Post Reply
Author
Message
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 Topic: [QUESTION] StatusBar and multiple Commandbars
    Posted: 26 July 2011 at 1:43pm
Hi,
 
Is there a way to have multiple Commandbars and have only one Statusbar in mainform?
I have more than one Commandbars control on a form (same reason as with the DockingPanes with PictureBox <> Form issue I started in Controls forum) and I would like to show user some info about the buttons on the toolbars when hovered.
 
If this can't be done, is there a way to create different toolbars and "attach" them to the proper PictureBox (or DockingPane) If this means that I have only Commandbars control so be it... Minor issue Wink
 
Thanks a lot in advance
 
 
 
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
Xander75 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 April 2007
Status: Offline
Points: 353
Post Options Post Options   Thanks (0) Thanks(0)   Quote Xander75 Quote  Post ReplyReply Direct Link To This Post Posted: 27 July 2011 at 3:56am
Aaron,

I believe you should be able to use many CommandBars and only one StatusBar. In my Projects I usually split out how I build up my GUI and create a reference to the StatusBar so I can get click events and what not from it. That way I can always then reference it.

Below is a small snippet of code form a project of mine that shows how you can create a StatusBar on a form, make it public and with events.

Public WithEvents MyStatusBar As XtremeCommandBars.StatusBar

Private Sub CreateStatusBar()
    ' Set up the Statusbar Style
    Dim Pane As StatusBarPane
    Set StatusBar = CommandBars.StatusBar
        StatusBar.Visible = True
        StatusBar.RibbonDividerIndex = 2
       
    Set Pane = StatusBar.AddPane(0)
    Set Pane = StatusBar.AddPane(ID_INDICATOR_FORECASTCOUNT)
        Pane.BeginGroup = True
        Pane.Button = True
        Pane.Text = vbNullString
        Pane.Width = 0
        Pane.Visible = False
   
    Set Pane = StatusBar.AddPane(ID_INDICATOR_NONFORECASTCOUNT)
        Pane.BeginGroup = True
        Pane.Text = vbNullString
        Pane.Width = 0
        Pane.Visible = False

    Set Pane = StatusBar.AddPane(ID_INDICATOR_CAPS)
        Pane.BeginGroup = True
       
    Set Pane = StatusBar.AddPane(ID_INDICATOR_NUM)
    Set Pane = StatusBar.AddPane(ID_INDICATOR_SCRL)

    Set MyStatusBar = StatusBar
End Sub


As for creating CommandBars then attaching them to PictureBoxes (or DockingPanes) I am not sure if that can be done as like you I have always used multiple instances of the CommandBars control to do just that. Would be nice if this could be done though.

Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition
Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)
Back to Top
younicke View Drop Down
Senior Member
Senior Member
Avatar

Joined: 11 March 2005
Status: Offline
Points: 107
Post Options Post Options   Thanks (0) Thanks(0)   Quote younicke Quote  Post ReplyReply Direct Link To This Post Posted: 27 July 2011 at 6:01am
in my case there are times that i use commandbars on other forms... and the way that i do to show the hint on the statusbar of the main form is by using this commandbars event

supposing this is your commandbar on other form

Private Sub CBarsOtherForm_ControlSelected(ByVal Control As XtremeCommandBars.ICommandBarControl)
    If Not Control Is Nothing Then
        'display hint here using the control.descriptiontext...
        frmMain.CommandBars.StatusBar.Pane(1).Text = Control.DescriptionText
    Else
         frmMain.CommandBars.StatusBar.Pane(1).Text = "Ready..."
    End If
End Sub
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: 29 July 2011 at 8:19am
Hi,
 
Thanks for both replies Wink
 
I guess this isn't going to be solved in an easy way...
 
Alexander: Do you have Commandbars for every form? Do you happen to use DockingPanes as well? Yes:How do you add toolbars to these panes? NO:Question for other users, how do you add toolbars to panes (Single Commandbar or same as me multiple Commandbars)?  
 
 
Allan: I guess this would be the easiest solution, it does work and easy to implement, just add ControlSelected event handler (for every used Commandbars) and copy/paste code Wink
 
 
Thanks a lot
 
 
 
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
Xander75 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 April 2007
Status: Offline
Points: 353
Post Options Post Options   Thanks (0) Thanks(0)   Quote Xander75 Quote  Post ReplyReply Direct Link To This Post Posted: 29 July 2011 at 8:52am
Aaron,

I try an use CommandBars only on forms were I don't want the ToolBar on the Main form (MDI App) to have the options.

younicke's is what I meant from my code snippet, the only difference being it that you can use the WithEvents in my code to fire button clicks if you require that code in the StatusBar.

I looked into using one CommandBar and trying to place menus that where floating into containers like PictureBoxes, DockingPanes etc but this didn't work as the CommandBars.AttachToWindow attaches the CommandBar control, not the separate toolbar or menubar Unhappy
Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition
Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)
Back to Top
younicke View Drop Down
Senior Member
Senior Member
Avatar

Joined: 11 March 2005
Status: Offline
Points: 107
Post Options Post Options   Thanks (0) Thanks(0)   Quote younicke Quote  Post ReplyReply Direct Link To This Post Posted: 29 July 2011 at 9:24am
u really have to use a separate commandbars for docking panes Cry there's no other way
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: 29 July 2011 at 10:16am
Hi,
 
Seems we can't have it all... Would be nice though, if CodeJock would add such thing. I was fiddling around with SetParent API and I'm able to reposition the toolbar but that's all. You can't drag toolbar around and width is calculated from the pane where the toolbar originally was located Ouch Now, I wouldn't mind if the toolbars weren't dragable but the width is a problem. Is there someone who has an idea or two?
 
CodeJock support? Any ideas? Future implementations?
 
Thanks a lot in advance
 
 
 
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
 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.