delphi - TAction.ShortCut not working in dynamically created TAction -


in delphi xe5: have tactionmanager (called actionmanager) , tribbon (called ribbon) on form. adding custom action this:

actionbar := actionmanager.actionbars.add; newaction := taction.create(mainform.actionmanager); newaction.name := 'topics'; newaction.caption := 'topics'; newaction.onexecute := mainform.helptopicsitemclick; newmenu := actionbar.items.add; newmenu.action := newaction; newaction.shortcut := texttoshortcut('f1'); 

after place them on ribbon in page/tab , in group:

rp := tribbonpage.create(actionmanager); rp.parent := ribbon; ribbon.addtab(rp).caption := 'help'; rg := tribbongroup.create(actionmanager); rg.parent := rp; rg.actionmanager := actionmanager; rg.caption := 'help'; rg.actionclient := actionbar; 

the action works fine when click it, when press 'f1' nothing happens. when add action manually using delphi editors shortcuts work fine.

i tried: newmenu.shortcut := newaction.shortcut

this doesn't help. missing?

when create new action actionlist property not automatically set owner provide create. have set actionlist explicitely make work.

newaction := taction.create(mainform.actionmanager); newaction.actionlist := mainform.actionmanager; newaction.name := 'topics'; 

Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -