Solved

How to perform radiobutton click?

Posted on 2004-09-07
5
372 Views
Last Modified: 2010-04-05
I want on form create atomaticaly make radiobutton click, how to do it?
0
Comment
Question by:selas
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 23

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 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month3 days, 19 hours left to enroll

630 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