![]() |
Adding commands to the Ribbon Bar icons |
Post Reply ![]() |
Author | |
benniboi ![]() Newbie ![]() Joined: 20 July 2007 Location: Australia Status: Offline Points: 14 |
![]() ![]() ![]() ![]() ![]() 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...
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
benniboi ![]() Newbie ![]() Joined: 20 July 2007 Location: Australia Status: Offline Points: 14 |
![]() ![]() ![]() ![]() ![]() |
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
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
from Samples\Ribbon\RibbonSample\RibbonSampleView.cpp file.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
benniboi ![]() Newbie ![]() Joined: 20 July 2007 Location: Australia Status: Offline Points: 14 |
![]() ![]() ![]() ![]() ![]() |
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
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
benniboi ![]() Newbie ![]() Joined: 20 July 2007 Location: Australia Status: Offline Points: 14 |
![]() ![]() ![]() ![]() ![]() |
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
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
benniboi ![]() Newbie ![]() Joined: 20 July 2007 Location: Australia Status: Offline Points: 14 |
![]() ![]() ![]() ![]() ![]() |
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.
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |