taction

Delphi: How do I stop TAction shortcut keys autorepeating?

旧巷老猫 提交于 2019-12-06 04:22:58
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. Intercept the WM_KEYDOWN messages, and look at bit 30 to see if it is auto-repeating. If it is, just don't pass on the message as usual and it will not be seen. You may need to enable form key-preview

Delphi idle handler only fires when I move the mouse

无人久伴 提交于 2019-12-05 20:02:49
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 ; procedure TMainForm.ActionNewButtonUpdate(Sender: TObject); begin ActionNewButton.Enabled :=

Delphi XE - TRibbon actions always send focus to MainForm

守給你的承諾、 提交于 2019-12-05 06:07:21
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? This is evidently by design. Sample code snippet from 'ribbonactnctrls.pas': procedure TRibbonBaseButtonControl.Click; begin inherited; SetFocus

How to make subcomponent TAction-s available at design time?

吃可爱长大的小学妹 提交于 2019-12-05 02:53:06
问题 In my custom component I created some TAction-s as subcomponents. They're all published, but I could not assign them at design time since they were not available through object inspector. How do you make them "iterable" by the object inspector? I have tried to set the Owner of the actions to the Owner of the custom component (which is the hosting Form) to no success. EDIT: It looks like Embarcadero changed Delphi IDE behaviour related with this problem. If you are using Delphi versions prior

Changing font of TActionMainMenuBar when using Vcl styles

偶尔善良 提交于 2019-12-04 11:17:09
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 change the Color but not the Font? As you say changing the font of the MenuItemTextNormal element (or any

How can I see who triggered an action in Delphi?

倖福魔咒の 提交于 2019-12-03 02:10:55
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: TButton Action = actDoStuff Left = 100 end object actDoStuff: TAction Caption = 'Do Stuff' OnExecute =

How can I handle a keyboard shortcut when my program isn't active?

[亡魂溺海] 提交于 2019-11-30 18:02:15
问题 Is it ok if i use it like this..for multiple events? unit Unit4; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Clipbrd; type TForm4 = class(TForm) procedure FormCreate(Sender: TObject); procedure WMHotkey(var Message: TWMHotKey); message WM_HOTKEY; procedure FormDestroy(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form4: TForm4; implementation const MY_ID = 123; MY_ID1 = 123; MY_ID2 = 123; {$R *

Why are : visible, control assigned TActions affecting the CPU usage of the application?

本秂侑毒 提交于 2019-11-28 04:40:25
问题 If a TAction is linked to an Object such as TToolButton ( Item of TToolBar ) or TActionClientItem ( Item of TActionToolBar ) and that Object is visible on runtime, then whenever you move the mouse in the form (anywhere but the Toolbars), there seems to be extra load being done on the CPU based on the number of visible TActions, that is in comparison to moving the mouse when none of the TAction linked Items are visible on either of the previous mentioned bars. It's obvious that the noticeable