Hallo zusammen,
ich habe ein Problem mit TActionManager, ActionLists und Action Shortcuts.
In Application.Mainform liegt der Actionmanager und einige ActionLists. Die Shortcuts der dort enthaltenen Actions funktionieren, wie gewünscht.
Die Actions lassen sich über zugehörige Buttons aufrufen.
Das Problem kommt, wenn ich eines meiner Programm Module (Frames) lade und im Mainform auf einem Panel anzeigen lasse.
Ich lade die Aktionen des Frames und füge für jede Aktion einen neuen Button ins interface ein. Das Funktioniert und ich kann dann auch die Funktion des Frames aufrufen.
Allerdings habe ich dann den Shortcut noch nicht. Dazu hab ich mir überlegt, das ich die Frame.ActionList zum Actionmanager hinzufüge. Das klappt auch, jedoch werden die Shortcuts nicht erkannt und damit werden die Actions nicht über Tastaturkürzel ausgelöst.
Hat jemand ne idee, was da falsch läuft, oder was ich vergessen habe?
Nachfolgend der Quellcode.
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33:
| LToolbar := getNewToolBar(); for LActnIdx := 0 to AFrame.IGetActionCount - 1 do begin LAction := AFrame.IGetActionByIndex(LActnIdx);
if pos('Separator', LAction.Caption) = 0 then begin LTBtn := TAdvGlowButton.Create(LToolBar); LTBtn.Transparent := true; LTBtn.Action := LAction; LTBtn.Height := 56; LToolBar.AddToolBarControl(LTBtn); end else if LAction.Visible then begin LToolBar.EndUpdate; LToolBar := getNewToolBar(); end; end; LToolBar.EndUpdate;
with ActionManager1 do begin while LinkedActionLists.count > 4 do begin LAListItem := LinkedActionLists[LinkedActionLists.count -1]; LAListItem.ActionList := nil; LinkedActionLists.Delete(LinkedActionLists.count -1); end;
LAList := AFrame.IGetActionList; if LAList <> nil then with LinkedActionLists.Add as TActionListItem do begin Caption := LAList.Name; ActionList := LAList; end; end; |
Gruß
CenBells
Moderiert von
Martok: Code- durch Delphi-Tags ersetzt
Eine Klasse beschreibt die Struktur und das Verhalten einer Menge gleichartiger Objekte.