Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 530149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:10:01+00:00 2026-05-13T09:10:01+00:00

As you can see in my question history, I’m developing a eBook manager, that

  • 0

As you can see in my question history, I’m developing a eBook manager, that will be open-source and I will release it in about 10 days, but I have a TRadioGroup, as you can see:
TRadioGroup Used On My Form http://img85.imageshack.us/img85/1830/radiogroup.png

And I want to store somethings in a variable(that needs to be a Integer) that will be "linked" with this TRadioGroup.

I need to do a if function like this:

Caption Of The TRadioButton -> Number that will need to be stored in the variable

Fit 2xWidth – Default -> 0
Fit 2xHeight -> 1
Fit Width -> 2
Fit Height -> 3

But I just used a TRadioGroup and a TRadioButton one time, different than in C# that I’ve used more than 20 times. Then I want to know what I need to put on the if function, because what it will do I already know how to do:

var
  num: Integer;

begin
  if(TRadioButton1 checked?)
  begin
    num := 0;
  end;
end.

What I need to put inside the brackets of the if function?

PS: I’m going to put the credits on the program for the people that helped me in this little project.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:10:01+00:00Added an answer on May 13, 2026 at 9:10 am

    A TRadioButton has the Checked property. But A TRadioGroup has the ItemIndex property.

    The items in a TRadioGroup are stored using a TStrings. So you can associate an object to each option and you can cast an integer to a TObject to be stored.

    Example:

    // fill the radiogroup
    radiogroup.Items.AddObject('Fit 2xWidth', TObject(0));
    radiogroup.Items.AddObject('Fit 2xHeight', TObject(1));
    radiogroup.Items.AddObject('Fit Width', TObject(2));
    radiogroup.Items.AddObject('Fit Height', TObject(3));
    radiogroup.ItemIndex := 0;
    

    To read the current setting:

    value := radiogroup.ItemIndex;
    

    Or to get the associated integer:

    index := radiogroup.ItemIndex;
    Assert(index>=0); // Sanity check
    value := Integer(radiogroup.Items.Objects[index]);
    

    In your case, the values are 0 to 3 so you can use the ItemIndex.

    As a note, if is not a function. A function is a piece of code that returns a value based on the input parameters. If is a statement, which is a command that can be executed. The if statement is special because it enables you to execute a different statement based on the if condition.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry about the stupid question however I can't see/ not good enough to solve
in this question I posted you can see the originating code sample for this
In my other question You can see code of my arr structure and PriorityQueue
This is not a programming question but I hope Microsoft programmer can see this
My apologies if this question has been asked before. I can see there are
Here is the code relevant to my question: http://jsfiddle.net/mkerny45/V23NK/ As you can see there
using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question
In Microsoft SQL Server: I have seen this question several times, but can't see
(Re-written question, please see history for original). The question is right there in the
NOTE: i did a complete rework of my question. you can see the original

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.