My Assistant
![]() ![]() |
|
|
May 1 2011, 11:54 AM
Post
#1
|
|
|
UtterAccess VIP Posts: 7,591 From: South coast, England |
OK, its probably me just missing something completely trivial - but I can't see it (IMG:style_emoticons/default/iconfused.gif)
I have the following (as part of my ribbon XML) CODE <group id="SeatDtls1" label="Seat details" getVisible="SetVisible"> <button id="fSeatdtls" size="large" screentip="Show seat booking information" getLabel="onGetLabel" imageMso="FileDocumentInspect" onAction="rbnAct" /> </group> With the following callback (part): CODE Public Sub onGetLabel(cntrl As IRibbonControl, ByRef Label) On Error GoTo err_proc Dim strLabel As String Set srcForm = Forms.frmbookings Select Case cntrl.ID ' Case .... Case "fSeatDtls" MsgBox cntrl.ID 'Test purposes Label = "Seat " & srcForm.SeatNo.Caption & " details" End Select exit_proc: Exit Sub err_proc: MsgBox err.Description Resume exit_proc End Sub elsewhere in my code I have: CODE If Not gobjRibMain Is Nothing Then gobjRibMain.InvalidateControl "fSeatDtls" MsgBox "Inval " & "fSeatDtls" 'Test purposes End If On start up the button XML correctly calls the onGetLabel callback and the correct label is displayed on the button When appropriate the invalidate control command is run, however the onGetLabel callback is NOT triggered. Does the getLabel callback only get triggered on ribbon load and not get called when a ribbon button control is invalidated? (NB I have not tried using the invalidatecontrol on a button to update the button caption before, The onAction callback works correctly and the same code works for a label control. I have tried a C&R and decompile with no effect.) TIA Edit: Well, I've not solved the problem! but I have used the same basic structure to change the text on the group: XML: CODE <group id="SeatDtls1" getLabel="onGetLabel" getVisible="SetVisible"> <button id="fSeatdtls" label="Seat details" size="large" screentip="Show seat booking information" getVisible="SetVisible" imageMso="FileDocumentInspect" onAction="rbnAct" /> </group> Invalidate code: CODE If Not gobjRibMain Is Nothing Then gobjRibMain.InvalidateControl "SeatDtls1" End If Callback code CODE Public Sub onGetLabel(cntrl As IRibbonControl, ByRef Label) On Error GoTo err_proc Set srcForm = Forms.frmbookings Select Case cntrl.ID ' Case ... Case "SeatDtls1" Label = "Seat " & srcForm.SeatNo.Caption End Select exit_proc: Exit Sub err_proc: MsgBox err.Description Resume exit_proc End Sub The XML and code are identical except that the callback/text changes are on a ribbon group (and work fine) But why not the button? (IMG:style_emoticons/default/shrug.gif) The code now indicates what I want, but has the effect of changing the width of the ribbon group when the text changes, not that it matters much just looks a bit odd. This post has been edited by pere_de_chipstick: May 1 2011, 02:59 PM |
|
|
|
May 2 2011, 11:18 AM
Post
#2
|
|
|
UtterAccess VIP Posts: 1,857 From: BC, Canada |
Have you tried NOT using the label attribute for the button if you are also using the getLabel callback?
Edit: Never mind, I reread the code at the start and it looks like you juust used the callback. Mike This post has been edited by MikeLyons: May 2 2011, 11:21 AM |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 25th May 2013 - 01:13 AM |