Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2003-03

Bug: Setting checkbox.checked triggers onclick

6 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt
to Mattias Gaertner: On Mon, 24 Mar 2003 09:28:05 +0100 (W. Europe Standard Time) I just tried under Delphi 6:…
Mattias Gaertner wrote 13 lines
On Mon, 24 Mar 2003 09:28:05 +0100 (W. Europe Standard Time) Michael Van Canneyt wrote: > > > On 23 Mar 2003, Tony Maro wrote: > > > It's not _supposed_ to do that is it? > > Let's say that it doesn't do that in Delphi. I just tried under Delphi 6: Yes it does. (changing TCustomCheckBox.Checked via program calls OnClick).

My apologies, you are right.

It is setting the ItemIndex of a TCombobox in code versus manually choosing an item that doesn't trigger the 'onchange' event. I believe there is also such an issue in TMenuItem. I would have to check that.

It's all the same issue of course.

Show quoted text 14 lines
> > I'm trying to detect when a user checks the box so I can enable a save > > button, but if I change from one record to another and programmatically > > set the .enabled property it triggers the onclick event for the > > checkbox. > > This is a good point, which depends actually on the toolkit used. > Personally, I think that the event 'OnClick' should be separated out in > 'OnClick' (clicked by user) and 'OnChange' (State of checkbox changed) > But this will give compatibility problems. I vote for this OnChange/OnClick separation. Should I add a boolean property 'UseOnChange'?

I think this is a good idea. It should be used consistently to separate user events from state changing events.

What should be the default?

Make a global var, which is used as default when creating a combobox. The default value should maybe be 'False' for Delphi compatibility.

Michael.

Reply by email

Mattias Gaertner
to Mattias Gaertner: On Mon, 24 Mar 2003 09:28:05 +0100 (W. Europe Standard Time) I just tried under Delphi 6:…
Show quoted text 20 lines
> > > I'm trying to detect when a user checks the box so I can enable a > > > save button, but if I change from one record to another and > > > programmatically set the .enabled property it triggers the onclick > > > event for the checkbox. > > > > This is a good point, which depends actually on the toolkit used. > > Personally, I think that the event 'OnClick' should be separated out > > in'OnClick' (clicked by user) and 'OnChange' (State of checkbox > > changed) But this will give compatibility problems. > > I vote for this OnChange/OnClick separation. > Should I add a boolean property 'UseOnChange'? I think this is a good idea. It should be used consistently to separate user events from state changing events. > What should be the default? Make a global var, which is used as default when creating a combobox. The default value should maybe be 'False' for Delphi compatibility.

It's done.
The global variable is named DefaultButtonControlUseOnChange. Long names for seldom used things.

Mattias

Reply by email

Mattias Gaertner
to Tony Maro: It's not _supposed_ to do that is it? I'm trying to detect when a user checks the box so…
Show quoted text 7 lines
On 23 Mar 2003, Tony Maro wrote: > It's not _supposed_ to do that is it? Let's say that it doesn't do that in Delphi.

I just tried under Delphi 6: Yes it does. (changing TCustomCheckBox.Checked via program calls OnClick).

Show quoted text 9 lines
> I'm trying to detect when a user checks the box so I can enable a save > button, but if I change from one record to another and programmatically > set the .enabled property it triggers the onclick event for the > checkbox. This is a good point, which depends actually on the toolkit used. Personally, I think that the event 'OnClick' should be separated out in 'OnClick' (clicked by user) and 'OnChange' (State of checkbox changed) But this will give compatibility problems.

I vote for this OnChange/OnClick separation.
Should I add a boolean property 'UseOnChange'?
What should be the default?

Mattias

Show quoted text 10 lines
If I recall correctly, Kylix has the same problem because Qt handles it differently from native Win32. Michael. _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives

Reply by email

Tony Maro

It's not _supposed_ to do that is it?

I'm trying to detect when a user checks the box so I can enable a save button, but if I change from one record to another and programmatically set the .enabled property it triggers the onclick event for the checkbox.

Tony Maro http://tony.maro.net/ Check out my software "CheckBook Tracker" A GPL (free) replacement for Microsoft Money!

Reply by email

Tony Maro
to Michael Van Canneyt: Let's say that it doesn't do that in Delphi. This is a good point, which depends actually…

Well my current workaround was just to disable the save button immediately after loading the data into the checkbox, so it's not the end of the world if it's a GTK / QT issue.

Thanks,
Tony

Michael Van Canneyt wrote 26 lines
On 23 Mar 2003, Tony Maro wrote: > It's not _supposed_ to do that is it? Let's say that it doesn't do that in Delphi. > > I'm trying to detect when a user checks the box so I can enable a save > button, but if I change from one record to another and programmatically > set the .enabled property it triggers the onclick event for the > checkbox. This is a good point, which depends actually on the toolkit used. Personally, I think that the event 'OnClick' should be separated out in 'OnClick' (clicked by user) and 'OnChange' (State of checkbox changed) But this will give compatibility problems. If I recall correctly, Kylix has the same problem because Qt handles it differently from native Win32. Michael. _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Tony Maro

Reply by email

Michael Van Canneyt
to Tony Maro: It's not _supposed_ to do that is it? I'm trying to detect when a user checks the box so…
Tony Maro wrote
It's not _supposed_ to do that is it?

Let's say that it doesn't do that in Delphi.

Show quoted text 5 lines
I'm trying to detect when a user checks the box so I can enable a save button, but if I change from one record to another and programmatically set the .enabled property it triggers the onclick event for the checkbox.

This is a good point, which depends actually on the toolkit used. Personally, I think that the event 'OnClick' should be separated out in 'OnClick' (clicked by user) and 'OnChange' (State of checkbox changed) But this will give compatibility problems.

If I recall correctly, Kylix has the same problem because Qt handles it differently from native Win32.

Michael.

Reply by email