Sign in Join
Wiki copytemporary

TRadioGroup/fr

Deutsch · English · Français · Suomi · Русский · 日本語

Un TRadioGroup est un groupe de boutons radio associés mais mutuellement exclusifs demandant à l'utilisateur de choisir l'une des alternatives proposées. C'est comme un TGroupBox avec des TRadioButtons intégrés.

Usage

Pour utiliser un TRadioGroup sur une fiche, vous pouvez simplement le sélectionner dans l'onglet Standard de la palette de composants et le placer sur la fiche.

Petit exemple

Les figures géométriques devraient être déssinées de manière aléatoire et selon le TRadioGroup de la fiche. RadioGroup1 détermine la forme, RadioGroup2 le nombre.

pascal
procedure TForm1.rgShapeClick(Sender: TObject);
begin
  Repaint;
end;
pascal
procedure TForm1.FormPaint(Sender: TObject);
var
  i: Integer;
begin
  if TryStrToInt(rgCount.Items[rgCount.ItemIndex], i) then
    for i:=1 to i do begin
      Canvas.Pen.Color:=Random($1000000);
      Canvas.Brush.Color:=Random($1000000);
      case rgShape.Items[rgShape.ItemIndex] of
        'Lines':      Canvas.Line(Random(ClientWidth), Random(ClientHeight), Random(ClientWidth), Random(ClientHeight));
        'Rectangles': Canvas.Rectangle(Random(ClientWidth), Random(ClientHeight), Random(ClientWidth), Random(ClientHeight));
        'Ellipses':   Canvas.Ellipse(Random(ClientWidth), Random(ClientHeight), Random(ClientWidth), Random(ClientHeight));
      end;
    end;
end;

Note : à chaque redessin, le résultat obtenu sera différent.

Voir aussi


From the Free Pascal wiki, page "TRadioGroup/fr", as it stood on 2020-03-01 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Edited on wiki.freepascal.org by 2 people, 2017–2020

From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.

WhenWhoWhat changed
E-ricCreated page
E-ricPetit exemple
TrevFixed syntax highlighting (minor)

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.