Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Adding commands to the Ribbon Bar icons
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Adding commands to the Ribbon Bar icons

 Post Reply Post Reply
Author
Message
benniboi View Drop Down
Newbie
Newbie


Joined: 20 July 2007
Location: Australia
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote benniboi Quote  Post ReplyReply Direct Link To This Post Topic: Adding commands to the Ribbon Bar icons
    Posted: 16 January 2008 at 7:54pm

I am using the Ribbon Bar to replace my standard menu but I am having some difficulty and in linking the Ribbon Bar icons to my existing procedures as well as adding new ones.

 
Are there any examples of how and where to change these? Any help would be greatly appreciated.
 
For example: How do I refer to the Fontlist dropdown box? If I have several fonts in my document (I am making a customised document editor/word processor) how can I show the correct font name on the Ribbon? The demo does not seeem to show this. I am also unsure how to refer to other items on the bar incl. font size etc...
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 17 January 2008 at 2:25am
Hi,
 
1. See MainFrame::LoadIcons() method in sample. It show how to load icons.
 
2. In Sample check

 ON_UPDATE_COMMAND_UI(ID_FONT_SIZE, OnUpdateComboSize)
 ON_XTP_EXECUTE(ID_FONT_SIZE, OnEditSize)
handlers
they show how to update size combo.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
benniboi View Drop Down
Newbie
Newbie


Joined: 20 July 2007
Location: Australia
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote benniboi Quote  Post ReplyReply Direct Link To This Post Posted: 17 January 2008 at 6:47pm
Hi Oleg, which sample are you referring to? I can't see
 
 ON_UPDATE_COMMAND_UI(ID_FONT_SIZE, OnUpdateComboSize)
 ON_XTP_EXECUTE(ID_FONT_SIZE, OnEditSize)
 
anywhere in the samples that I have
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 18 January 2008 at 2:13am
Hi,
 
from Samples\Ribbon\RibbonSample\RibbonSampleView.cpp file.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
benniboi View Drop Down
Newbie
Newbie


Joined: 20 July 2007
Location: Australia
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote benniboi Quote  Post ReplyReply Direct Link To This Post Posted: 19 January 2008 at 8:49pm
Oh I just realised I posted this in the wrong forum, sorry.  I am actually using VB6. Could you point me to the equivalent code in VB6 please? Thanks
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 24 January 2008 at 8:33am
Hi,
 
Here simple sample. Create form, add CommandBars and RichTextBox and this code:
 

Private Sub CommandBars_Execute(ByVal Control As XtremeCommandBars.ICommandBarControl)
    Select Case Control.Id
        Case 100:
            Dim Combo As CommandBarComboBox
            Set Combo = Control
            RichTextBox1.SelFontSize = Combo.Text
    End Select
End Sub
Private Sub CommandBars_Update(ByVal Control As XtremeCommandBars.ICommandBarControl)
On Error Resume Next
    Select Case Control.Id
        Case 100:
            Dim Combo As CommandBarComboBox
            Set Combo = Control
            Combo.Text = RichTextBox1.SelFontSize
    End Select
End Sub
Private Sub CommandBars_ResizeClient(ByVal Left As Long, ByVal Top As Long, ByVal Right As Long, ByVal Bottom As Long)
    RichTextBox1.Move Left, Top, Right - Left, Bottom - Top
End Sub

Private Sub Form_Load()
    Dim Combo As CommandBarComboBox
    Set Combo = CommandBars.ActiveMenuBar.Controls.Add(xtpControlComboBox, 100, "Size")
    Combo.DropDownListStyle = True
    Combo.AddItem 10
    Combo.AddItem 20
    Combo.AddItem 30
   
End Sub
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
benniboi View Drop Down
Newbie
Newbie


Joined: 20 July 2007
Location: Australia
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote benniboi Quote  Post ReplyReply Direct Link To This Post Posted: 24 January 2008 at 5:01pm
Hi Oleg
 
I don't think you understand what I need. How do I refer to the existing combo boxes on the Ribbon bar such as the Font name and Font size?
 
This is my scenario: I am making a customised word processor so when I go over a piece of text, how can I show the correct fontname in the combo box in the ribbon bar? Where can I find how to refer back to it? I cannot see this in any examples. Have you got any more samples that deal with the ribbon bar? The ones that are provided are very basic and the documentation does not really help in this case.
 
Also, another main issue that I raised. Where can I find ALL the constants that are listed in the RESOURCE.BAS? Different samples have different actions and there are some that are missing entirely. Can you please provide me with the entire list.

Thanks
Ben
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 25 January 2008 at 2:31am

Start new sample and insert this code. You will see how it works.

There is no predefined constants for resource.bas - you choose any you need and call them as you like.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
benniboi View Drop Down
Newbie
Newbie


Joined: 20 July 2007
Location: Australia
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote benniboi Quote  Post ReplyReply Direct Link To This Post Posted: 31 January 2008 at 11:13pm

I can see how the demo works but my code is very similar to it and it does not:

Private Sub CommandBars_Execute(ByVal Control As XtremeCommandBars.ICommandBarControl)
 
        Case ID_FONT_SIZE
            ActiveForm.TXTextControl1.FontSize = Control.Text
        Case ID_FONT_FACE
            ActiveForm.TXTextControl1.FontName = Control.Text
 
End Sub
 
Private Sub CommandBars_Update(ByVal Control As XtremeCommandBars.ICommandBarControl)
 
        Case ID_FONT_FACE
                Dim ComboFontFace As CommandBarComboBox
                Set ComboFontFace = Control
                ComboFontFace.Text = ActiveForm.TXTextControl1.FontName
        Case ID_FONT_SIZE
                Dim ComboFontSize As CommandBarComboBox
                Set ComboFontSize = Control
                ComboFontSize.Text = ActiveForm.TXTextControl1.FontSize
End sub
 
 
Among the problems I get is a type mismatch on Set ComboFontFace = control and Set ComboFontSize = Control
 
The combo boxes do not update as I go over selected text nor does the font change when I try and change the font name or size in the combo boxes.
 
I'm really confused, I'd appreciate any help. Thanks.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 01 February 2008 at 1:45am
Code Looks right. Send whole form file here or to support@codejock.com
 
Be sure you have only Combo boxes with this id. Check that ID_FONT_SIZE is not 0.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
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.141 seconds.