Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to perform radiobutton click?

Posted on 2004-09-07
5
Medium Priority
?
375 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 23

Accepted Solution

by:
Ferruccio Accalai earned 2000 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 23

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

824 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