Solved

How to perform radiobutton click?

Posted on 2004-09-07
5
371 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 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Suggested Solutions

Title # Comments Views Activity
Magic Software info 18 154
JAudiorecorder record freezing the app 29 92
Wincontrol not (correctly) drawn 15 59
Firemonkey how to swip panel with finger tap 1 41
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…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

734 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