Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Начинающим";
Текущий архив: 2008.11.30;
Скачать: [xml.tar.bz2];

Вниз

Вопрос об 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;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.46 MB
Время: 0.005 c
8-1188300158
Dr. Andrew
2007-08-28 15:22
2008.11.30
Ошибка при заполнении текста bitmap. Почему?


15-1222537509
Городской Шаман
2008-09-27 21:45
2008.11.30
А зачем линуксоидам Delphi?


15-1222666562
Задачник
2008-09-29 09:36
2008.11.30
Движение с переменным ускорением Помогите посчитать?


3-1210767541
Beer_Hunter
2008-05-14 16:19
2008.11.30
excel и dbf


15-1222511662
Игорь Шевченко
2008-09-27 14:34
2008.11.30
Предлагается звукотехника





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский