在运行时更改功能区 [英] Changing ribbon at run time

查看:54
本文介绍了在运行时更改功能区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


目前我的功能区是"MainRibbonUI"。存储在USysRibbons表中,这是当前数据库选项中设置的功能区。


由于我现在想要开发多语言自定义,我想要存储几种语言的多个色带并给出用户有机会在运行时更改语言。


我如何实现这一目标?


谢谢,劳罗

解决方案

Hello Lauro,


您需要在功能区XML中使用功能区回调而不是属性。如果需要,您可以拨打

IRibbon.Invalidate
方法,我验证功能区用户界面的所有控件的缓存值。  对于
加载项实现的每个回调,响应都被缓存。例如,如果加载项编写器实现 
getImage  回调
一个按钮的过程,该函数被调用一次,图像加载,然后如果图像需要更新,则缓存的图像是而不是回忆过程。此过程保持原位,直到加载项通过使用 
无效  方法,
,此时,再次调用回调程序并返回响应缓存。然后,加载项可以通过调用 
刷新  方法。

 Dim MyRibbon As IRibbonUI 
Sub MyAddInInitialize(Ribbon As IRibbonUI)
Set MyRibbon = Ribbon
End Sub

Sub myFunction()
'使所有这些添加的缓存无效 - in's controls
MyRibbon.Invalidate()
End Sub


了解更多关于Fluent UI(又名以下系列文章中的功能区UI):


自定义2007 Office适用于开发人员的流畅功能区(第1部分,共3部分)


为开发人员自定义2007 Office Fluent功能区(第2部分,共3部分)


为开发人员自定义2007 Office Fluent功能区(第3部分,共3部分)


您还可以找到以下文章中描述的示例解决方案:


第11章:创建动态功能区自定义(1/2)


第11章:创建动态功能区自定义(2/2)



Hi,

At present I have my ribbon "MainRibbonUI" stored in the USysRibbons table and this is the ribbon set in the Current Database options.

Since I want now to develop a multilanguage customization, I wanted to have several ribbons in several languages stored and give the user the opportunity to change language at run time.

How can I achieve this?

Thanks, Lauro

解决方案

Hello Lauro,

You need to use ribbon callbacks in the ribbon XML instead of attributes. When required you may call the IRibbon.Invalidate method which invalidates the cached values for all of the controls of the Ribbon user interface. For each of the callbacks the add-in implements, the responses are cached. For example, if an add-in writer implements the getImage callback procedure for a button, the function is called once, the image loads, and then if the image needs to be updated, the cached image is used instead of recalling the procedure. This process remains in-place until the add-in signals that the cached values are invalid by using the Invalidate method, at which time, the callback procedure is again called and the return response is cached. The add-in can then force an immediate update of the UI by calling the Refresh method.

Dim MyRibbon As IRibbonUI
Sub MyAddInInitialize(Ribbon As IRibbonUI)
    Set MyRibbon = Ribbon
End Sub

Sub myFunction()
    ‘ Invalidates the caches of all of this add-in’s controls 
    MyRibbon.Invalidate()            
End Sub

Read more about the Fluent UI (aka Ribbon UI) in the following series of articles:

Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)

Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)

Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)

Also you may find the sample solution described in the following articles:

Chapter 11: Creating Dynamic Ribbon Customizations (1 of 2)

Chapter 11: Creating Dynamic Ribbon Customizations (2 of 2)


这篇关于在运行时更改功能区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆