tcheckbox

Why doesn't OnUpdate trigger for invisible components [duplicate]

眉间皱痕 提交于 2019-12-22 18:17:31
问题 This question already has answers here : How can I use an action to determine a control's visibility? (3 answers) Closed 5 years ago . When I make a component invisible by setting the connected TAction to invisible, the onupdate event will not trigger anymore. To recreate, do the following. Create a new VCL forms application Drop a button, a checkbox and an actionlist on the form. Create a new action, and connect the button to it. Write the following code for the actions OnExecute and

Change CheckBox state without calling OnClick Event

China☆狼群 提交于 2019-12-21 07:25:52
问题 I'm wondering so when I change state of CheckBox CheckBox->Checked=false; It calls CheckBoxOnClick Event , how to avoid it ? 回答1: You could surround the onClick event code with something like if myFlag then begin ...event code... end; If you don't want it to be executed, set myFlag to false and after the checkbox state's change set it back to true. 回答2: Another option is to change the protected ClicksDisable property using an interposer class like this: type THackCheckBox = class

Change CheckBox state without calling OnClick Event

醉酒当歌 提交于 2019-12-21 07:25:07
问题 I'm wondering so when I change state of CheckBox CheckBox->Checked=false; It calls CheckBoxOnClick Event , how to avoid it ? 回答1: You could surround the onClick event code with something like if myFlag then begin ...event code... end; If you don't want it to be executed, set myFlag to false and after the checkbox state's change set it back to true. 回答2: Another option is to change the protected ClicksDisable property using an interposer class like this: type THackCheckBox = class

Event Handler for Dynamically Created CheckBox

独自空忆成欢 提交于 2019-12-13 19:26:13
问题 I wrote a C++ program using Borland C++ Builder 5. The program dynamically creates an array of TCheckBox objects. I have tried to write an OnClick event handler that would identify which checkbox is being clicked and execute some instructions based on that. My event handler is based on similar posts to this website, but I cannot seem to make it work. Here is the (abbreviated) code // Header declaration void __fastcall CBoxClick(TObject *Sender); // End Header // CBoxClick function (the event

CheckBox in a DBGrid

故事扮演 提交于 2019-12-08 21:41:20
问题 My question is how to set a column in dbgrid in Delphi 7 which will be with a checkbox items. Thanks in advance. 回答1: The easiest and most complete method as tested by me is as follows: In the private section of your unit, declare a global for retaining grid options. It will be used for restoring after temporary disabling text editing while entering the checkbox column - as this is maybe one of the little errors mentioned by Jordan Borisovin regarding the delphi.about.com article private

How to verify if the checkbox is checked in a Delphi TTaskDialog?

别说谁变了你拦得住时间么 提交于 2019-12-07 05:31:50
问题 OK, this should be easy, but I do not find the solution, at least not in the not so good documentation.. In a TTaskDialog , you have the option to add one check-box. You can control its initial state by means of the tfVerificationFlagChecked flag in Flags . But how to get the state after the dialog has been Execute d? Of course one can use the OnVerificationClicked event and toggle a local variable, initially equal to the initial state of the checkbox, on each call. But one would expect a

Why doesn't OnUpdate trigger for invisible components [duplicate]

吃可爱长大的小学妹 提交于 2019-12-06 11:28:06
This question already has answers here : How can I use an action to determine a control's visibility? (3 answers) Closed 5 years ago . When I make a component invisible by setting the connected TAction to invisible, the onupdate event will not trigger anymore. To recreate, do the following. Create a new VCL forms application Drop a button, a checkbox and an actionlist on the form. Create a new action, and connect the button to it. Write the following code for the actions OnExecute and OnUpdate event: procedure TForm1.Action1Execute(Sender: TObject); begin ShowMessage('Test'); end; procedure

How to show a check box in TListView header column?

北城以北 提交于 2019-12-06 06:53:00
问题 I need to have a check box in a column header of a TListView: I have tried the following code: with CheckBox1 do begin Parent := ListView1; Top := 0; Left := 4; end; but the check box doesn't always work as expected. How can I properly create a check box in TListView header column ? 回答1: The following code will add the check box to the list view's header and shows how to handle the click event for it. Please note, that the following code is supported since Windows Vista. unit Unit1; interface

How to verify if the checkbox is checked in a Delphi TTaskDialog?

半城伤御伤魂 提交于 2019-12-05 11:43:55
OK, this should be easy, but I do not find the solution, at least not in the not so good documentation .. In a TTaskDialog , you have the option to add one check-box. You can control its initial state by means of the tfVerificationFlagChecked flag in Flags . But how to get the state after the dialog has been Execute d? Of course one can use the OnVerificationClicked event and toggle a local variable, initially equal to the initial state of the checkbox, on each call. But one would expect a more natural solution. O my God, Embarcadero has made a mistake. A few tests of mine showed that if the

Put a TCheckBox inside a TStringGrid in Delphi

夙愿已清 提交于 2019-11-28 18:27:46
I want to put a TCheckBox inside a TStringGrid in Delphi in every cell of certain column. I'm using Delphi XE. You should draw your own checkboxes, preferably using visual themes, if enabled. This is a simple sketch of how to do that: const Checked: array[1..4] of boolean = (false, true, false, true); procedure TForm4.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); const PADDING = 4; var h: HTHEME; s: TSize; r: TRect; begin if (ACol = 2) and (ARow >= 1) then begin FillRect(StringGrid1.Canvas.Handle, Rect, GetStockObject(WHITE_BRUSH)); s.cx :=