Adding to 'Recent Files' and changing terminology

Support forum for ARG-Software Design Lab. Command Bars Library [http://www.arg.kirov.ru/]
Locked
Kevin
Posts: 4
Joined: Tue Nov 09, 2010 6:30 pm

Adding to 'Recent Files' and changing terminology

Post by Kevin »

Hello,

Does anyone have the code to be able to change the Recent Files terminology on the application menu to something else? Also, how can I build this list programmatically?

Thanks!
AlexG
ARG-Software Design Lab.
Posts: 36
Joined: Sat Nov 14, 2009 5:14 pm

Re: Adding to 'Recent Files' and changing terminology

Post by AlexG »

Hi Kevin,

To change the title (caption) of the 'Recent Files' you need to change the Caption property of the Ribbon.OfficeMenu.RecentFileList object, for example:

Code: Select all

ThisForm.Ribbon.OfficeMenu.RecentFileList.Caption = "My Recent Files"
How to fill the list? There are two options:

1) Put your code to the OnBuildRecentFileList event/method of the Ribbon.OfficeMenu object:

Code: Select all

LParameters taItems

Dimension taItems[ 4, ALen( m.taItems, 2)]

taItems[ 1, 1] = 0
taItems[ 1, 2] = "&1 Recent File #1"
taItems[ 1, 3] = "MessageBox( 'Recent File #1')"
taItems[ 1, 4] = "Open Recent File #1"
taItems[ 1, 5] = 0

taItems[ 2, 1] = 0
taItems[ 2, 2] = "&2 Recent File #2"
taItems[ 2, 3] = "MessageBox( 'Recent File #2')"
taItems[ 2, 4] = "Open Recent File #2"
taItems[ 2, 5] = 0

taItems[ 3, 1] = 0
taItems[ 3, 2] = "&3 Recent File #3"
taItems[ 3, 3] = "MessageBox( 'Recent File #3')"
taItems[ 3, 4] = "Open Recent File #3"
taItems[ 3, 5] = 0

taItems[ 4, 1] = 0
taItems[ 4, 2] = "&4 Recent File #4"
taItems[ 4, 3] = "MessageBox( 'Recent File #4')"
taItems[ 4, 4] = "Open Recent File #4"
taItems[ 4, 5] = 0

Return .T.
Ribbon_RecentFiles_1.png
Ribbon_RecentFiles_1.png (23.13 KiB) Viewed 4884 times
2) Specify the function that fills the list in the Ribbon.OfficeMenu.OnBuildRecentFileListDelegate property, for example:

Code: Select all

ThisForm.Ribbon.OfficeMenu.OnBuildRecentFileListDelegate = "ThisForm.GetRecentFileListContent"

Code: Select all

*** Procedure Form.GetRecentFileListContent

LParameters toControl, taItems

Dimension taItems[ 4, ALen( m.taItems, 2)]

taItems[ 1, 1] = 0
taItems[ 1, 2] = "Custom item #&1"
taItems[ 1, 3] = "MessageBox( 'Custom item #1')"
taItems[ 1, 4] = "Custom item #1"
taItems[ 1, 5] = ThisForm.Ribbon.TabHome.GrpClipboard.cmdCut.GetIconID()

taItems[ 2, 1] = _ACB_CIO_CHECKED
taItems[ 2, 2] = "Custom item #\<2"
taItems[ 2, 3] = "MessageBox( 'Custom item #2')"
taItems[ 2, 4] = "Custom item #2"
taItems[ 2, 5] = 0

taItems[ 3, 1] = _ACB_CIO_DISABLED + _ACB_CIO_BEGINGROUP
taItems[ 3, 2] = "Custom item #&3"
taItems[ 3, 3] = "MessageBox( 'Custom item #3')"
taItems[ 3, 4] = "Custom item #3"
taItems[ 3, 5] = 0

taItems[ 4, 1] = _ACB_CIO_BEGINGROUP + _ACB_CIO_MRU
taItems[ 4, 2] = "Custom item #&4"
taItems[ 4, 3] = "MessageBox( This.Caption)"	&& 'Custom item #4')"
taItems[ 4, 4] = "Custom item #4"
taItems[ 4, 5] = 0

Return .T.
With best regards,

Alex Grigorjev
(ARG-Software Design Lab.)
Locked