Solved

How to perform radiobutton click?

Posted on 2004-09-07
5
364 Views
Last Modified: 2010-04-05
I want on form create atomaticaly make radiobutton click, how to do it?
0
Comment
Question by:selas
  • 3
  • 2
5 Comments
 
LVL 22

Accepted Solution

by:
Ferruccio Accalai earned 500 total points
ID: 11994684
If you want just do it link Form1.Oncreate directly to Radiobutton1click in object inspector.
If you need to do other things other than this write in oncreate

procedure TForm1.FormCreate(Sender: TObject);
begin
//do something
Radiobutton1click(self);
//do some other thing
end;

F68 ;-)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 11994686
as far as i know a change of the checked-state fires a click-event
like

RadioButton1.Checked := not RadioButton1.Checked;
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 11994698
from delphi help

---------------------------
Occurs when the user clicks the control.

Delphi syntax:

property OnClick: TNotifyEvent;

C++ syntax:

__property Classes::TNotifyEvent OnClick = {read=FOnClick, write=FOnClick, stored=
IsOnClickStored};

Description

Use the OnClick event handler to respond when the user clicks the control. If the control has an associated action, and that action has an OnExecute method, the action’s OnExecute method responds to click events unless it is superseded by an OnClick event handler.

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.

For a form, an OnClick event occurs when the user clicks a blank area of the form or on a disabled component.

---------------------------

see
The Checked property of a radio button is set to true.


meikl ;-)
0
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 11994705
yep, i was meaning how to execute just the OnClick without change the checked state, otherwise it can be done so

procedure TForm1.FormCreate(Sender: TObject);
begin
//do something
Radiobutton1.checked := true;
//do some other thing
end;

But let say that you have already checked it in design time and want just to perform the onclick in on create do it as above in my first comment

F68 ;-)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 11994718
>But let say that you have already checked it in design time

should be also possible

//do something
Radiobutton1.checked := False;
Radiobutton1.checked := True;
//do some other thing

meikl ;-)
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question