PDA

View Full Version : Reusing a menu button on different screens



joud
3 Nov 2017, 2:35 AM
What is the best way to reuse a menu button on different screen's toolbars without duplicating it?

Thanks,
Joud

petr.vecera
6 Nov 2017, 5:15 AM
Using linking aka use xtypes

Do drag and drop , create a link http://prntscr.com/h6vspu and http://prntscr.com/h6vsui

Or you mean something different?

joud
6 Nov 2017, 11:01 AM
Using linking aka use xtypes

Do drag and drop , create a link http://prntscr.com/h6vspu and http://prntscr.com/h6vsui

Or you mean something different?

I already tried drag and drop but the menu button is moved to the other panel, the message "copy, move, link" doesn't appear :/

petr.vecera
6 Nov 2017, 11:02 AM
Which class is your menu button ? Can you share screenshot or copy the code ?

joud
6 Nov 2017, 11:59 AM
Here's the code:

xtype: 'toolbar',
docked: 'top',
layout: {
type: 'hbox',
pack: 'center'
},
items: [
{
xtype: 'button',
ui: 'action',
docked: 'left',
menu: {
xtype: 'menu',
minWidth: '150px',
items: [
{
xtype: 'menuitem',
text: 'New'
},
{
xtype: 'menuitem',
text: 'Open'
},
{
xtype: 'menuitem',
text: 'Edit'
},
{
xtype: 'menuitem',
text: 'Save'
}
]
}
}
]

wayne.rudd
7 Nov 2017, 1:04 PM
You can right click on menu button and 'Promote to class' - that will give you a linkable class

joud
8 Nov 2017, 12:42 AM
Thanks a lot, it worked.