View Issue Details

IDProjectCategoryView StatusLast Update
0021739LazarusLCLpublic2012-04-16 09:12
ReporterDavid Jenkins Assigned ToPaul Ishenin  
Status resolvedResolutionfixed 
Product Version0.9.30.5 (SVN) 
Fixed in Version1.1 (SVN) 
Summary0021739: Close button response to [esc] on Carbon
DescriptionIf a button is created and has both the Default and Cancel properties set to true before its parent is assigned (in the button's constructor or creating the button at runtime), the Cancel button can be incorrectly cleared. In that situation, the button's FDefault and FCancel properties are set, but Parent isn't assigned, so it can't update the DefaultControl/CancelControl properties. When it does finally calls TCustomButton.UpdateDefaultCancel, SetDefaultControl calls UpdateRolesForForm, which only returns [ccrfDefault], since CancelControl hasn't been assigned yet.

Suggest fix is to save off FCancel and used stored value

Patch against rev 36681 is attached
TagsNo tags attached.
Fixed in Revision36811
Attached Files


2012-04-13 19:01 (543 bytes)   
--- /Users/djenkins/laz-changes/14827/	2012-04-11 17:19:00.000000000 
+++ /Users/djenkins/laz-changes/14827/	2012-04-11 17:20:09.000000000 
@@ -317,13 +317,15 @@
 procedure TCustomButton.UpdateDefaultCancel;
   Form: TCustomForm;
+  OldCancel: Boolean;
   Form := GetParentForm(Self);
   if Form <> nil then
+    OldCancel := FCancel;
     if FDefault then
       Form.DefaultControl := Self;
-    if FCancel then
+    if OldCancel then
       Form.CancelControl := Self;
   WSSetDefault; (543 bytes)   

Paul Ishenin

2012-04-16 09:12

manager   ~0058646

I used a bit different approach.

Please test and close if ok.

Issue History

Date Modified Username Field Change
2012-04-13 19:01 David Jenkins New Issue
2012-04-13 19:01 David Jenkins File Added:
2012-04-13 19:01 David Jenkins Widgetset => Carbon
2012-04-16 09:12 Paul Ishenin Fixed in Revision => 36811
2012-04-16 09:12 Paul Ishenin LazTarget => -
2012-04-16 09:12 Paul Ishenin Status new => resolved
2012-04-16 09:12 Paul Ishenin Fixed in Version => 1.1 (SVN)
2012-04-16 09:12 Paul Ishenin Resolution open => fixed
2012-04-16 09:12 Paul Ishenin Assigned To => Paul Ishenin
2012-04-16 09:12 Paul Ishenin Note Added: 0058646