Copie du wikimiroir

Ceci est un miroir du wiki de pascal.chat. La modification, l’historique et la connexion se trouvent là-bas.

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.

Version 1, dernière modification par WikiArchive .