Solved

How to perform radiobutton click?

Posted on 2004-09-07
5
360 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
>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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now