TDBRadioGroup strange behavior lazarus / 16-Databases ---------------------------------------------------------------------- gato2707 · 2012-01-15 03:11 Hi to all: I'm porting a Delphi app to Lazarus. I'm using a DBRadioGroup for showing the state of a database field that only can has two differnt values. As the component is used only for informative proposals, the user shouldn't change field value. In Delphi is quite simple, setting it's ReadOnly property to true. But when I try to apply the same in Lazarus is possible change the index of the DBRadioGroup clicking on it. This behavior doesn't affect the value of the field, but it might be confuse for the user. Setting it's Enable property to False stops the values update and show the component ugly. Are there any way to modify this behavoir? Thanks in advance Regards from Mexico ---------------------------------------------------------------------- goodname · 2012-01-15 14:25 There is a canModify that is part of the tCustomRadioGroup. Try setting this to false. http://lazarus- ccr.sourceforge.net/docs/lcl/extctrls/tcustomradiogroup.html ---------------------------------------------------------------------- LuizAmérico · 2012-01-15 22:25 Add a bug report with an demo project in http://bugs.freepascal.org ---------------------------------------------------------------------- gato2707 · 2012-01-16 02:11 goodname: CanModify is a virtual method (function) with no arguments. For use it I need to redefine the entire class o create a new one. I'm trying to port the app using the "standard" classes (as possible) because the app will be liberated as free software (GPL). Thank for your suggestion. LuizAmerico: I'll prepare a simple demo project ASAP. Thank for your advice. ---------------------------------------------------------------------- LuizAmérico · 2012-01-16 21:10 I looked at the problem and seems, at least to me, hard to implement in all widgetsets. Under windows is doable but under others widgetsets i can't figure a way of implementing this. I hope someone can find a solution. ---------------------------------------------------------------------- gato2707 · 2012-01-17 04:36 I wrote few code to partially solve the present behavoir 1) Declare a global Integer variable (rgIndexRemainder) 2) In the Dataset associated component add a DatasetChange Event write: Code: [Select]rgIndexRemainder := DBRadioGroup.ItemIndex; 3) In the TDBRadioGroup OnClick Event write: Code: [Select]DBRadioGroup.ItemIndex := rgIndexRemainder; This prevents any change made by a user's click. But the focus is still moved into the Item's Caption. I hope this help someone in the future.