Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2008.11.30;
Скачать: CL | DM;

Вниз

Вопрос об OnClick компонента CheckBox.   Найти похожие ветки 

 
DJones   (2008-10-22 09:50) [0]

Насколько я понимаю, данное событие срабатывает при изменении свойства checked ( не нажатием мыши, из обработчика другого компонента)... Возможно ли обойти это, т е чтобы изменение  checked мышью вызывало OnClick, а изменение значение Checked  в коде  - нет...?


 
DJones   (2008-10-22 10:05) [1]

я вот решил в обработчике Onclick выполнять определенные действия только когда checkBox.tag = 0, а там где меняю checked - вмеменно меняю тег до 1 например... не знаю правильно ли...


 
Ega23 ©   (2008-10-22 10:25) [2]


> я вот решил в обработчике Onclick выполнять определенные
> действия только когда checkBox.tag = 0, а там где меняю
> checked - вмеменно меняю тег до 1 например... не знаю правильно
> ли...


ну как вариант. Я бы немного по-другому сделал - менял бы обработчик на nil, а потом восстанавливал бы его адрес.


 
Vlad Oshin ©   (2008-10-22 10:26) [3]

работает правильно - значит правильно

+

type
 TForm1 = class(TForm)
   CheckBox1: TCheckBox;
   Button1: TButton;
   procedure CheckBox1Click(Sender: TObject);
   procedure Button1Click(Sender: TObject);
 private
   { Private declarations }
 public
   { Public declarations }
 end;

 tcb = class(TButtonControl);

var
 Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
 tcb(CheckBox1).ClicksDisabled := true;
 CheckBox1.Checked := not CheckBox1.Checked;
end;

procedure TForm1.CheckBox1Click(Sender: TObject);
begin
 if CheckBox1.Checked
  then  ShowMessage("Da")
  else  ShowMessage("Net");
end;


 
brother ©   (2008-10-22 10:27) [4]

я не понял, в чем проблемма?


 
Vlad Oshin ©   (2008-10-22 10:35) [5]

procedure TForm1.Button1Click(Sender: TObject);
begin
// tcb(CheckBox1).ClicksDisabled := true; //срабатывает CheckBox1Click
 CheckBox1.Checked := not CheckBox1.Checked;
end;

procedure TForm1.CheckBox1Click(Sender: TObject);
begin
 if CheckBox1.Checked
  then  ShowMessage("Da")
  else  ShowMessage("Net");
end;


 
Ega23 ©   (2008-10-22 10:42) [6]


> я не понял, в чем проблемма?


автор хочет странного.


 
Правильный$Вася   (2008-10-22 11:23) [7]

Usually OnClick occurs when the user presses and releases the left mouse button with the mouse pointer over the control. This event can also occur when

The user selects an item in a grid, outline, list, or combo box by pressing an arrow key.
- The user presses Spacebar while a button or check box has focus.
- The user presses Enter when the active form has a default button (specified by the Default property).
- The user presses Esc when the active form has a cancel button (specified by the Cancel property).
- The user presses the accelerator key for a button or check box. For example, if the value of the Caption property of a check box is "&Bold", the B is underlined at runtime and the OnClick event of the check box is triggered when the user presses Alt+B.
- The Checked property of a radio button is set to true.
- The value of the Checked property of a check box is changed.
- The Click method of a menu item is called.
- For a form, an OnClick event occurs when the user clicks a blank area of the form or on a disabled component.



Страницы: 1 вся ветка

Текущий архив: 2008.11.30;
Скачать: CL | DM;

Наверх




Память: 0.48 MB
Время: 0.012 c
6-1195722943
Леонид Федьков
2007-11-22 12:15
2008.11.30
Повторный вызов idHttp1.Get(...)


15-1221642011
Дуб
2008-09-17 13:00
2008.11.30
А вот про разные мышления в решении простой задачки


2-1224589591
SkyN
2008-10-21 15:46
2008.11.30
как правильно освобождать память от динамического массива?


15-1222766110
Квэнди
2008-09-30 13:15
2008.11.30
watches list process is not acessible


2-1224484811
JustI
2008-10-20 10:40
2008.11.30
AutomationObject