Difference between revisions of "TCheckGroup/fr"

From Lazarus wiki
Jump to navigationJump to search
(Created page with "{{TCheckGroup}} A '''TCheckGroup''' image:tcheckgroup.png is a control that comprises a group of TCheckBox items physically and logically grouped together on a contai...")
 
Line 1: Line 1:
 
{{TCheckGroup}}
 
{{TCheckGroup}}
  
A '''TCheckGroup''' [[image:tcheckgroup.png]] is a control that comprises a group of [[TCheckBox]] items physically and logically grouped together on a container component.
+
Un '''TCheckGroup''' [[image:tcheckgroup.png]] est un contrôle qui comporte un groupe d'articles avec des [[TCheckBox/fr|TCheckBox]] placé dans un composant conteneur.
  
 
= Usage =
 
= Usage =
To use a TCheckGroup on a [[TForm|form]], you can simply select it on the [[Standard tab]] of the [[Component Palette]] and place it by clicking on the form.
+
Pour utiliser un TCheckGroup sur une [[TForm/fr|fiche]], vous pouvez simplement le sélectionner dans l'[[Standard tab/fr|onglet Standard]] de la [[Component Palette/fr|palette de composants]] et le placer en cliquant sur la fiche.
  
= Petit exemple =
+
== Petit exemple ==
It changes the background color of a form. This color is determined by adding the individual color components:
+
Il modifie la couleur de fond d'une fiche. Cette couleur est obtenue en additionnant les composants individuelles de couleur :
 
+
* Créez une nouvelle application et place un TCheckGroup sur votre fiche.
* create a new application and place a TCheckGroup on your form
+
* Dans l'inspecteur d'objet, modifiez la propriété ''Name'' en ''cgRed'' et ''Caption'' en ''Red''.
* in the object inspector change the property ''Name'' of ''CheckGroup1'' to ''cgRed'' and the caption to ''Red''
+
* Ajoutez les CheckBox dans ''cgRed'':
* add the checkboxes for ''cgRed'':
+
** Dans l'inspecteur d'objet, sélectionnez la propriété ''Items'' de ''cgRed''.
** in the object inspector select the property ''Items'' of ''cgRed''  
+
** Cliquez sur le bouton [...], l'éditeur de liste de chaînes s'ouvre.
** click on the button [...], the character chain editor opens
+
** Entrez les valeurs ''1 2 4 8 16 32 64 128'' sur autant de lignes puis compléter en cliquant sur le bouton ''OK''.
** write among one another ''1 2 4 8 16 32 64 128'' and complete the entry with the ''OK'' button
+
* Copier ce TCheckGroup à l'aide du clic droit sur ''cgRed'' et en cliquant après sur ''Copy''.
* copy this TCheckGroup by right click ''cgRed'' in the form and click on ''Copy''
+
* Cliquez droit sur la fiche puis sur ''Insérer'', ce qui crée un TCheckGroup nommé ''cgRed1''.
* right-click the form and click on ''Insert'', which creates TCheckGroup named ''cgRed1''
+
* Maintenant modifiez ''Name'' de ''cgRed1'' en ''cgGreen'' et l'intitulé en ''Green''.
* now change the ''Name'' of ''cgRed1'' to ''cgGreen'' and the ''Caption'' to ''Green''
+
* Recommencez la copie pour créer le TCheckGroup nommé ''cgBlue'' intitulé ''Blue''.
* insert even a TCheckGroup and change the name to ''cgBlue'' and the caption to ''Blue''
+
* A chaque fois qu'un CheckBox est cliqué, la couleur changera :
* whenever a CheckBox is clicked, the color will change:
+
** Dans l'inspecteur d'objet, créez le gestionnaire d'événement ''OnItemClick'' de ''cgRed'' en cliquant sur le bouton [...] en face de l'événement ''OnItemClick''
** in the object inspector create the ''OnItemClick'' event handler of ''cgRed'' by clicking the button [...] next to the event ''OnItemClick''
+
** Sélectionnez aussi pour ''cgGreen'' et ''cgBlue'' ce gestionnaire d'événement, en choisissant pour chacun le gestionnaire ''cgRedItemClick'' dans le ComboBox en face de l'événement ''OnItemClick'' (le gestionnaire d'événement est ainsi partagé entre les trois composants).
** select for ''cgGreen'' and ''cgBlue'' also this event handler, by choosing each next to the event ''OnItemClick'' ComboBox ''cgRedItemClick''
+
** Ecrivez le code suivant dans le gestionnaire d'événement :
** write following code in the event handler:
 
 
<syntaxhighlight>
 
<syntaxhighlight>
 
procedure TForm1.cgRedItemClick(Sender: TObject;
 
procedure TForm1.cgRedItemClick(Sender: TObject;
Line 38: Line 37:
 
end;  
 
end;  
 
</syntaxhighlight>
 
</syntaxhighlight>
* start your program, it could look like:  
+
* Démarrez votre programme, il devrait ressembler à ceci :  
  
 
[[image:ExampleTCheckGroup.png]]
 
[[image:ExampleTCheckGroup.png]]

Revision as of 13:25, 31 August 2017

Deutsch (de) English (en) suomi (fi) français (fr) 日本語 (ja) русский (ru) 中文(中国大陆)‎ (zh_CN)

Un TCheckGroup tcheckgroup.png est un contrôle qui comporte un groupe d'articles avec des TCheckBox placé dans un composant conteneur.

Usage

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

Petit exemple

Il modifie la couleur de fond d'une fiche. Cette couleur est obtenue en additionnant les composants individuelles de couleur :

  • Créez une nouvelle application et place un TCheckGroup sur votre fiche.
  • Dans l'inspecteur d'objet, modifiez la propriété Name en cgRed et Caption en Red.
  • Ajoutez les CheckBox dans cgRed:
    • Dans l'inspecteur d'objet, sélectionnez la propriété Items de cgRed.
    • Cliquez sur le bouton [...], l'éditeur de liste de chaînes s'ouvre.
    • Entrez les valeurs 1 2 4 8 16 32 64 128 sur autant de lignes puis compléter en cliquant sur le bouton OK.
  • Copier ce TCheckGroup à l'aide du clic droit sur cgRed et en cliquant après sur Copy.
  • Cliquez droit sur la fiche puis sur Insérer, ce qui crée un TCheckGroup nommé cgRed1.
  • Maintenant modifiez Name de cgRed1 en cgGreen et l'intitulé en Green.
  • Recommencez la copie pour créer le TCheckGroup nommé cgBlue intitulé Blue.
  • A chaque fois qu'un CheckBox est cliqué, la couleur changera :
    • Dans l'inspecteur d'objet, créez le gestionnaire d'événement OnItemClick de cgRed en cliquant sur le bouton [...] en face de l'événement OnItemClick
    • Sélectionnez aussi pour cgGreen et cgBlue ce gestionnaire d'événement, en choisissant pour chacun le gestionnaire cgRedItemClick dans le ComboBox en face de l'événement OnItemClick (le gestionnaire d'événement est ainsi partagé entre les trois composants).
    • Ecrivez le code suivant dans le gestionnaire d'événement :
procedure TForm1.cgRedItemClick(Sender: TObject;
  Index: integer);
var
  i, c: Integer;
begin
  c:=$000000;                                               //first the color is black
  for i:=0 to 7 do begin                                    //test Items 0..7 of all Checkgroups
    if cgRed.Checked[i]   then c:=c + 1 shl i;              //amount of red   $000000..$0000FF
    if cgGreen.Checked[i] then c:=c + 1 shl (i + 8);        //amount of green $000000..$00FF00
    if cgBlue.Checked[i]  then c:=c + 1 shl (i + 16);       //amount of blue  $000000..$FF0000
  end;
  Color:=c;
end;
  • Démarrez votre programme, il devrait ressembler à ceci :

ExampleTCheckGroup.png

Voir aussi


Composant LCL
Onglet de palette Composants
Standard TMainMenu • TPopupMenu • TButton • TLabel • TEdit • TMemo • TToggleBox • TCheckBox • TRadioButton • TListBox • TComboBox • TScrollBar • TGroupBox • TRadioGroup • TCheckGroup • TPanel • TFrame • TActionList
Additional TBitBtn • TSpeedButton • TStaticText • TImage • TShape • TBevel • TPaintBox • TNotebook • TLabeledEdit • TSplitter • TTrayIcon • TControlBar • TFlowPanel • TMaskEdit • TCheckListBox • TScrollBox • TApplicationProperties • TStringGrid • TDrawGrid • TPairSplitter • TColorBox • TColorListBox • TValueListEditor
Common Controls TTrackBar • TProgressBar • TTreeView • TListView • TStatusBar • TToolBar • TCoolBar • TUpDown • TPageControl • TTabControl • THeaderControl • TImageList • TPopupNotifier • TDateTimePicker
Dialogs TOpenDialog • TSaveDialog • TSelectDirectoryDialog • TColorDialog • TFontDialog • TFindDialog • TReplaceDialog • TOpenPictureDialog • TSavePictureDialog • TCalendarDialog • TCalculatorDialog • TPrinterSetupDialog • TPrintDialog • TPageSetupDialog • TTaskDialog
Data Controls TDBNavigator • TDBText • TDBEdit • TDBMemo • TDBImage • TDBListBox • TDBLookupListBox • TDBComboBox • TDBLookupComboBox • TDBCheckBox • TDBRadioGroup • TDBCalendar • TDBGroupBox • TDBGrid • TDBDateTimePicker
Data Access TDataSource • TBufDataset • TMemDataset • TSdfDataSet • TFixedFormatDataSet • TDbf
System TTimer • TIdleTimer • TLazComponentQueue • THTMLHelpDatabase • THTMLBrowserHelpViewer • TAsyncProcess • TProcessUTF8 • TProcess • TSimpleIPCClient • TSimpleIPCServer • TXMLConfig • TEventLog • TServiceManager • TCHMHelpDatabase • TLHelpConnector
Misc TColorButton • TSpinEdit • TFloatSpinEdit • TArrow • TCalendar • TEditButton • TFileNameEdit • TDirectoryEdit • TDateEdit • TTimeEdit • TCalcEdit • TFileListBox • TFilterComboBox • TComboBoxEx • TCheckComboBox • TButtonPanel • TShellTreeView • TShellListView • TXMLPropStorage • TINIPropStorage • TIDEDialogLayoutStorage • TMRUManager • TStrHolder
LazControls TCheckBoxThemed • TDividerBevel • TExtendedNotebook • TListFilterEdit • TListViewFilterEdit • TTreeFilterEdit • TShortPathEdit • TLvlGraphControl
RTTI TTIEdit • TTIComboBox • TTIButton • TTICheckBox • TTILabel • TTIGroupBox • TTIRadioGroup • TTICheckGroup • TTICheckListBox • TTIListBox • TTIMemo • TTICalendar • TTIImage • TTIFloatSpinEdit • TTISpinEdit • TTITrackBar • TTIProgressBar • TTIMaskEdit • TTIColorButton • TMultiPropertyLink • TTIPropertyGrid • TTIGrid
SQLdb TSQLQuery • TSQLTransaction • TSQLScript • TSQLConnector • TMSSQLConnection • TSybaseConnection • TPQConnection • TPQTEventMonitor • TOracleConnection • TODBCConnection • TMySQL40Connection • TMySQL41Connection • TMySQL50Connection • TMySQL51Connection • TMySQL55Connection • TMySQL56Connection • TSQLite3Connection • TIBConnection • TFBAdmin • TFBEventMonitor • TSQLDBLibraryLoader
Pascal Script TPSScript • TPSScriptDebugger • TPSDllPlugin • TPSImport_Classes • TPSImport_DateUtils • TPSImport_ComObj • TPSImport_DB • TPSImport_Forms • TPSImport_Controls • TPSImport_StdCtrls • TPSCustomPlugin
SynEdit TSynEdit • TSynCompletion • TSynAutoComplete • TSynMacroRecorder • TSynExporterHTML • TSynPluginSyncroEdit • TSynPasSyn • TSynFreePascalSyn • TSynCppSyn • TSynJavaSyn • TSynPerlSyn • TSynHTMLSyn • TSynXMLSyn • TSynLFMSyn • TSynDiffSyn • TSynUNIXShellScriptSyn • TSynCssSyn • TSynPHPSyn • TSynTeXSyn • TSynSQLSyn • TSynPythonSyn • TSynVBSyn • TSynAnySyn • TSynMultiSyn • TSynBatSyn • TSynIniSyn • TSynPoSyn
Chart TChart • TListChartSource • TRandomChartSource • TUserDefinedChartSource • TCalculatedChartSource • TDbChartSource • TChartToolset • TChartAxisTransformations • TChartStyles • TChartLegendPanel • TChartNavScrollBar • TChartNavPanel • TIntervalChartSource • TDateTimeIntervalChartSource • TChartListBox • TChartExtentLink • TChartImageList
IPro TIpFileDataProvider • TIpHttpDataProvider • TIpHtmlPanel