How can I make the "<tab id="xx" getLabel" attribute accept parameter in RibbonUI? (1 Viewer)

sinsabit

New member
Local time
Today, 22:51
Joined
Jan 27, 2010
Messages
4
How can I make the "<tab id="xx" getLabel" attribute accept parameter in RibbonUI?

Hi everyone,

I am automating the ribbon to accept several languages which get fed from a strings table and feed the result through the getLabel attribute

In the XML in USysRibbons:
<tab id="rbntabDataEntry" getLabel="GetLabel" >

On startup the ribbon loads English and then re-validates depending on what language the user chooses in the login form. This is a string fed through by the TempVars! below.

In the "RibbonLoader" module:
Public Sub GetLabel(control As IRibbonControl, ByRef s)
Dim sMsg As String
sMsg = DLookup(TempVars!sLanguage, "tblCaptionStrings", "CaptionName ='" & control.Id & "'")
s = sMsg
End Sub

It all works fine for the buttons and groups controls but refuses to feed the fetched string into the tab control complaining of a null object, but I have tested and it is not a null.

I also tested whether the "getLabel" attribute actually works on the tab by feeding it straight text and it works fine.

Can anyone tell me why ths is not working?

All the best

Paul
 

vbaInet

AWF VIP
Local time
Today, 15:51
Joined
Jan 22, 2010
Messages
26,374
Re: How can I make the "<tab id="xx" getLabel" attribute accept parameter in RibbonUI

Hi everyone,

I am automating the ribbon to accept several languages which get fed from a strings table and feed the result through the getLabel attribute

In the XML in USysRibbons:
<tab id="rbntabDataEntry" getLabel="GetLabel" >

On startup the ribbon loads English and then re-validates depending on what language the user chooses in the login form. This is a string fed through by the TempVars! below.

In the "RibbonLoader" module:
Public Sub GetLabel(control As IRibbonControl, ByRef s)
Dim sMsg As String
sMsg = DLookup(TempVars!sLanguage, "tblCaptionStrings", "CaptionName ='" & control.Id & "'")
s = sMsg
End Sub

It all works fine for the buttons and groups controls but refuses to feed the fetched string into the tab control complaining of a null object, but I have tested and it is not a null.

I also tested whether the "getLabel" attribute actually works on the tab by feeding it straight text and it works fine.

Can anyone tell me why ths is not working?

All the best

Paul

You need to have an onLoad call back in your ribbon definition and a cache of the ribbon needs to be stored as a global variable. Check out this link:

http://www.accessribbon.de/en/?Access_-_Ribbons
 

sinsabit

New member
Local time
Today, 22:51
Joined
Jan 27, 2010
Messages
4
Re: How can I make the "<tab id="xx" getLabel" attribute accept parameter in RibbonUI

Is this what you mean?..

Public gobjRibbon As IRibbonUI

Public Sub OnRibbonLoad(ribbon As IRibbonUI)
Set gobjRibbon = ribbon
End Sub

I already have it in my code.

The problem is where the DLOOKUP pulls the string from the table based on the lookup key "rbntabDataEntry" which is the tab control id and also the lookup field in the string table.

It pulls the strings from the table into the button and group controls ok, just not with the tab control.

I wonder if there is something different about the tab control as opposed to the other controls on the ribbon?
 

vbaInet

AWF VIP
Local time
Today, 15:51
Joined
Jan 22, 2010
Messages
26,374
Re: How can I make the "<tab id="xx" getLabel" attribute accept parameter in RibbonUI

Is this what you mean?..

Public gobjRibbon As IRibbonUI

Public Sub OnRibbonLoad(ribbon As IRibbonUI)
Set gobjRibbon = ribbon
End Sub

I already have it in my code.

The problem is where the DLOOKUP pulls the string from the table based on the lookup key "rbntabDataEntry" which is the tab control id and also the lookup field in the string table.

It pulls the strings from the table into the button and group controls ok, just not with the tab control.

I wonder if there is something different about the tab control as opposed to the other controls on the ribbon?


That's the first step. What are the paramters for that call back? Check the site. You will need to create a function that will set store the caption in a global variable and after that line you call:

gobjRibbon.InvalidateControl controlID
 

vbaInet

AWF VIP
Local time
Today, 15:51
Joined
Jan 22, 2010
Messages
26,374
Re: How can I make the "<tab id="xx" getLabel" attribute accept parameter in RibbonUI

Is this what you mean?..

Public gobjRibbon As IRibbonUI

Public Sub OnRibbonLoad(ribbon As IRibbonUI)
Set gobjRibbon = ribbon
End Sub

I already have it in my code.

The problem is where the DLOOKUP pulls the string from the table based on the lookup key "rbntabDataEntry" which is the tab control id and also the lookup field in the string table.

It pulls the strings from the table into the button and group controls ok, just not with the tab control.

I wonder if there is something different about the tab control as opposed to the other controls on the ribbon?


That's the first step. What are the paramters for that call back? Check the site. You will need to create a function that will set store the caption in a global variable and after that line you call:

gobjRibbon.InvalidateControl controlID
 

Users who are viewing this thread

Top Bottom