taction

Delphi XE - TRibbon actions always send focus to MainForm

徘徊边缘 提交于 2019-12-22 05:10:54
问题 When I place a TRibbon control on a form that is not the MainForm of the application, that TRibbon's actions (i.e. Cut, Paste) will always return focus to the MainForm after the action is executed. This occurs even if the TForm that holds the TRibbon is not a child of the MainForm. I am using Windows 7 64-bit, Embarcadero RAD Studio XE Version 15.0.3953.35171. Am I using the TRibbon control incorrectly, or is this an issue with the TRibbon? 回答1: This is evidently by design. Sample code

How can I create a most recently used file list in Delphi 2009?

故事扮演 提交于 2019-12-21 02:47:21
问题 I have an TActionManager, and a TActionMainMenuBar, and I know how to add an TActionClientItem for each MRU file to the main menu bar. But do I have to create a separate action for each MRU file in the list? Or is there a way to create just one action, and somehow pass a tag or something to the action's OnExecute event based on which MRU file was clicked? Delphi's help says: "For more information about MRU lists, sample code, and methods for finding actions in lists, see FindItemByAction and

How can I see who triggered an action in Delphi?

谁说胖子不能爱 提交于 2019-12-20 12:06:38
问题 When a TAction event fires, the "Sender" is always the action itself. Usually that's the most useful, but is it somehow possible to find out who triggered the action's OnExecute event? Example Let's say you have a form with the following: 2 buttons, called Button1 and Button2 1 TAction called actDoStuff The same action is assigned to both buttons. Is it possible to show which button I clicked? Example.dfm object Form1: TForm1 object Button1: TButton Action = actDoStuff end object Button2:

How do I add support for actions in my component

谁说我不能喝 提交于 2019-12-18 05:59:10
问题 What do I need to do for adding actions support to my component. It is a button component but I guess it is the same for whatever component type it is. Any information or how to will help. 回答1: That depends on how you define action support . There is two kinds: A possibly customized Action property of your component, which is assignable by an Action component The Action component itself. An action property Every TControl descendant has an Action property which execution is by default linked

Delphi idle handler only fires when I move the mouse

拟墨画扇 提交于 2019-12-12 09:55:28
问题 I have an OnIdle handler in my D2006 app. With this code: procedure TMainForm.ApplicationEvents1Idle(Sender: TObject; var Done: Boolean); begin Inc (IdleCalls) ; Sleep (10) ; Done := False ; end ; the app runs smoothly, the idle handler is called 100 times per second, and the CPU usage is next to zero. I then added a TActionList and connected up some controls to actions, coded an Execute and Update handler. procedure TMainForm.ActionNewButtonExecute(Sender: TObject); begin DoNewProject ; end

Renaming TAction for another form

谁说胖子不能爱 提交于 2019-12-10 16:27:18
问题 I have 2 forms which I'd like to share one single TActionManager and assigned TAction -s. First form is main form - it holds TActionManager , TAction with caption "Action". Main menu of Form1 has this action and menuitem caption property set to "Action A". Form2 includes Form1 and also assigns action to menuitem and caption is set to "Action B". During design time everything looks good - menu items are named "Action A" and "Action B" in Form1 and Form2 and same action is assigned. It also

How do I programatically add actions to an Action Manager in Delphi 2010

会有一股神秘感。 提交于 2019-12-10 11:22:55
问题 I am trying to dynamically add actionitems, I can add the item and it works when I do this: HostActionItem := ActionManager.ActionBars[0].Items[0].Items[2]; NewItem := HostAction.Items.Add; NewItem.Action := MyActionToPerform; NewItem.Caption := Description; NewItem.ImageIndex := 1; NewItem.Tag := 13; However, when the action Execute method fires I attempt to get the ActionComponent from the Sender object like this: if (Sender is TAction) then tag := (Sender As TAction).ActionComponent.Tag;

Changing font of TActionMainMenuBar when using Vcl styles

邮差的信 提交于 2019-12-09 18:36:18
问题 Normally one could change the font of a TActionMainMenuBar or TMainMenu like this: Screen.MenuFont.Name := 'Calibri'; When using Vcl styles this isn't possible any more if a StyleHook is registered for the component. I went into the Bitmap Style Designer (formerly known as Vcl Style Designer) and changed the font for the MenuItemTextNormal . Problem is that changing the Font does nothing, I can only successfully change the Color of the text. Clearly I'm missing something here, why can I

Delphi: How do I stop TAction shortcut keys autorepeating?

烂漫一生 提交于 2019-12-07 16:12:59
问题 I'm using a Delphi TActionList, with Shortcut Keys for some actions. I want to prevent certain actions from being triggered multiple times by keyboard auto-repeat, but I do not want to affect auto-repeat operation globally. What's the best way of doing this? Clarification : I still need to handle multiple fast keypresses - it's only the keypresses generated by auto-repeat that I want to ignore. 回答1: Intercept the WM_KEYDOWN messages, and look at bit 30 to see if it is auto-repeating. If it is

How do I programatically add actions to an Action Manager in Delphi 2010

霸气de小男生 提交于 2019-12-06 05:42:47
I am trying to dynamically add actionitems, I can add the item and it works when I do this: HostActionItem := ActionManager.ActionBars[0].Items[0].Items[2]; NewItem := HostAction.Items.Add; NewItem.Action := MyActionToPerform; NewItem.Caption := Description; NewItem.ImageIndex := 1; NewItem.Tag := 13; However, when the action Execute method fires I attempt to get the ActionComponent from the Sender object like this: if (Sender is TAction) then tag := (Sender As TAction).ActionComponent.Tag; But the ActionComponent is always nil. Why is the ActionComponent not being initialised? Sertac Akyuz