TBitBtn : bkOK does not match Delphi 6 behaviour
Original Reporter info from Mantis: davitof
-
Reporter name: Frederic Da Vitoria
Original Reporter info from Mantis: davitof
- Reporter name: Frederic Da Vitoria
Description:
See forum thread here http://forum.lazarus.freepascal.org/index.php/topic,21567.0.html
In Delphi 6, setting the Kind property of a TBitBtn to bkOK was enough to make it work. According to the Delphi help, bkOK triggers the green check mark (this is OK in Lazarus), the button becomes the default button, (because Default is set to True) and ModalResult is set to mrOK. After conversion of a Delphi source to Lazarus, this is not true any more. Actually, in Delphi, when looking at the dfm contents, the Default and ModalResult properties are not mentioned which means they retain their default values, but the application behaves as if they were modified, and the Delphi IDE shows them as set just like the documentation says. I suspect that in Delphi, the Default and ModalResult getters actually read the Kind property as well as the Default or ModalResult values. This makes sense as it allows to separate for example the Default value "inherited" from the Kind from the Default value manually set by the user. If Delphi did not do it this way, if a user cleared the Kind, the IDE would have no way to know if the Default value was set automatically (in which case it should be cleared too) or if if was manually set by the user (in which case the IDE should leave it alone).
According to the Lazarus code, Kind by itself seems only used for the glyph, I could not find any sign of an impact on behaviour. When setting Kind to bkOK in Lazarus, it seems that Lazarus sets physically sets Default and ModalResult to the correct values.
I am currently not sure if this is a conversion issue or an lcl problem. Is Lazarus current behaviour consistent with recent Delphi versions (post-D6)? If it is, shouldn't the converter try detect a Delphi6 source and make the necessary corrections? If Lazarus does not match current Delphi behaviour, then this would be lcl bug.
This may be related to http://bugs.freepascal.org/view.php?id=21801
I did my tests on Lazarus 1.0.10 and trunk.
Mantis conversion info:
- Mantis ID: 24772
- OS: Windows
- OS Build: Windows 7 64bits
- Build: revision 2511
- Platform: Sony Vaio
- Version: 1.0.11 (SVN)
- Monitored by: » davitof (Frederic Da Vitoria)