Recent

Author Topic: [SOLVED] TRadiogroup selection changed event  (Read 9160 times)

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
[SOLVED] TRadiogroup selection changed event
« on: January 24, 2012, 11:43:30 am »
Hi all,

I'm sure many of you know the answer to this one: I want to know if a user selected a new/different item in a TRadioGroup. I can't seem to find any event of the RadioGroup control....

Having no Delphi background, I must be overlooking something simple...

Thanks,
BigChimp
« Last Edit: January 25, 2012, 04:52:53 pm by BigChimp »
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: TRadiogroup selection changed event
« Reply #1 on: January 24, 2012, 12:03:19 pm »
I could be overlooking too, but it seams to be missing. I also couldnt find it in Delphi docs:

http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/!!MEMBEROVERVIEW_ExtCtrls_TRadioGroup.html

If this is really the case we could add OnSelectionChanged for example.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: TRadiogroup selection changed event
« Reply #2 on: January 24, 2012, 01:06:35 pm »
Felipe, sounds good. Do you want me to raise a bug in mantis?
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: TRadiogroup selection changed event
« Reply #3 on: January 24, 2012, 01:34:45 pm »
I researched a bit more and I found the "gotcha", OnClick reacts to other selections too, like keyboard up/down arrow:

http://www.tek-tips.com/viewthread.cfm?qid=589219

And tested here in LCL-gtk2 and it indeed works like that. But this doesn't exclude the idea of having a better named event too, which would do the same thing. But I am very busy these days ... but yes, please open a bug about it.
« Last Edit: January 24, 2012, 01:39:05 pm by felipemdc »

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: TRadiogroup selection changed event
« Reply #4 on: January 24, 2012, 01:40:35 pm »
D6 didn't have a special event in TRadioGroup neither. The OnClick event is  is what you need.

D6 help for Onclick:

Code: [Select]
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.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: TRadiogroup selection changed event
« Reply #5 on: January 25, 2012, 04:52:00 pm »
Thanks all.
Submitted feature request to bugtracker:
http://bugs.freepascal.org/view.php?id=21155
« Last Edit: January 25, 2012, 05:37:57 pm by BigChimp »
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

 

TinyPortal © 2005-2018