Difference between revisions of "TCheckGroup/ja"

From Lazarus wiki
Jump to navigationJump to search
Line 4: Line 4:
 
'''TCheckGroup'''[[image:tcheckgroup.png]]は、コンテナコンポーネント上で物理的におよび論理的にグループ化されたTCheckBoxアイテムのグループを含むコントロールである。
 
'''TCheckGroup'''[[image:tcheckgroup.png]]は、コンテナコンポーネント上で物理的におよび論理的にグループ化されたTCheckBoxアイテムのグループを含むコントロールである。
  
==Usage==
 
  
To use a TCheckGroup on a [[TForm|form]], you can simply select it on the  [[Standard tab/ja|Standardタブ]] of the [[Component Palette/ja|コンポーネントパレット]] and place it by clicking on the form.
 
  
===Small example===
+
TForm上でTCheckGroupを使用するには、単に[[Component Palette/ja|コンポーネントパレット]]の[[Standard tab/ja|Standardタブ]]でそれを選択し、フォーム上でクリックして配置する。
  
It changes the background color of a form. This color is determined by adding the individual color components:
+
===例===
 
+
フォームの背景色を変更する。この色は、個々の色成分を加算して決定される:
* create a new application and place a TCheckGroup on your form
+
* 新しいアプリケーションを作成し、フォームにTCheckGroupを配置する。
* in the object inspector change the property ''Name'' of ''CheckGroup1'' to ''cgRed'' and the caption to ''Red''
+
* オブジェクトインスペクタで、''CheckGroup1''''Name''プロパティを''cgRed''に変更し、キャプションを''Red''に変更する。
* add the checkboxes for ''cgRed'':
+
* ''cgRed''にチェックボックスを追加する。
** in the object inspector select the property ''Items'' of ''cgRed''  
+
** オブジェクトインスペクタで、''cgRed''''Items''プロパティを選択する。
** click on the button [...], the character chain editor opens
+
** [...]ボタンをクリックすると、文字列エディタが開く。
** write among one another ''1 2 4 8 16 32 64 128'' and complete the entry with the ''OK'' button
+
** 1 2 4 8 16 32 64 128と入力し、''OK''ボタンをクリックしてエントリを完了する。
* copy this TCheckGroup by right click ''cgRed'' in the form and click on ''Copy''
+
* フォーム上の''cgRed''を右クリックし、「コピー」をクリックしてこのTCheckGroupをコピーする。
* right-click the form and click on ''Insert'', which creates TCheckGroup named ''cgRed1''
+
* フォームを右クリックし、''Insert''をクリックして、名前が''cgRed1''のTCheckGroupが作成される。
* now change the ''Name'' of ''cgRed1'' to ''cgGreen'' and the ''Caption'' to ''Green''
+
* ''cgRed1''''Name''''cgGreen''に変更し、''Caption''''Green''に変更する。
* insert even a TCheckGroup and change the name to ''cgBlue'' and the caption to ''Blue''
+
* TCheckGroupを挿入し、その名前を''cgBlue''に変更し、キャプションを''Blue''に変更する。
* whenever a CheckBox is clicked, the color will change:
+
* チェックボックスがクリックされるたびに、色が変わる。
** in the object inspector create the ''OnItemClick'' event handler of ''cgRed'' by clicking the button [...] next to the event ''OnItemClick''
+
** オブジェクトインスペクタで、''cgRed''の''OnItemClick''イベントハンドラを作成するために、''OnItemClick''イベントの隣の [...] ボタンをクリックする。
** select for ''cgGreen'' and ''cgBlue'' also this event handler, by choosing each next to the event ''OnItemClick'' ComboBox ''cgRedItemClick''
+
** ''cgGreen''と''cgBlue''についても同じイベントハンドラを選択するために、''OnItemClick''イベントの隣にあるComboBoxでそれぞれ''cgRedItemClick''を選択する。
** write following code in the event handler:
+
** ''cgGreen''''cgBlue''に対しても同じイベントハンドラを選択するために、''OnItemClick''イベントの隣にあるコンボボックスでそれぞれ''cgRedItemClick''を選択する。
 +
** イベントハンドラに以下のコードを記述する:
  
 
<syntaxhighlight lang=pascal>
 
<syntaxhighlight lang=pascal>
Line 41: Line 40:
 
end;  
 
end;  
 
</syntaxhighlight>
 
</syntaxhighlight>
* start your program, it could look like:  
+
* プログラムを実行すると、以下のように見えるだろう:  
  
 
[[image:ExampleTCheckGroup.png]]
 
[[image:ExampleTCheckGroup.png]]
 
  
 
==Accessing the Check Boxes==
 
==Accessing the Check Boxes==

Revision as of 10:05, 24 March 2024

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

日本語版メニュー
メインページ - Lazarus Documentation日本語版 - 翻訳ノート - 日本語障害情報

TCheckGrouptcheckgroup.pngは、コンテナコンポーネント上で物理的におよび論理的にグループ化されたTCheckBoxアイテムのグループを含むコントロールである。


TForm上でTCheckGroupを使用するには、単にコンポーネントパレットStandardタブでそれを選択し、フォーム上でクリックして配置する。

フォームの背景色を変更する。この色は、個々の色成分を加算して決定される:

  • 新しいアプリケーションを作成し、フォームにTCheckGroupを配置する。
  • オブジェクトインスペクタで、CheckGroup1NameプロパティをcgRedに変更し、キャプションをRedに変更する。
  • cgRedにチェックボックスを追加する。
    • オブジェクトインスペクタで、cgRedItemsプロパティを選択する。
    • [...]ボタンをクリックすると、文字列エディタが開く。
    • 1 2 4 8 16 32 64 128と入力し、OKボタンをクリックしてエントリを完了する。
  • フォーム上のcgRedを右クリックし、「コピー」をクリックしてこのTCheckGroupをコピーする。
  • フォームを右クリックし、Insertをクリックして、名前がcgRed1のTCheckGroupが作成される。
  • cgRed1NamecgGreenに変更し、CaptionGreenに変更する。
  • TCheckGroupを挿入し、その名前をcgBlueに変更し、キャプションをBlueに変更する。
  • チェックボックスがクリックされるたびに、色が変わる。
    • オブジェクトインスペクタで、cgRedOnItemClickイベントハンドラを作成するために、OnItemClickイベントの隣の [...] ボタンをクリックする。
    • cgGreencgBlueについても同じイベントハンドラを選択するために、OnItemClickイベントの隣にあるComboBoxでそれぞれcgRedItemClickを選択する。
    • cgGreencgBlueに対しても同じイベントハンドラを選択するために、OnItemClickイベントの隣にあるコンボボックスでそれぞれcgRedItemClickを選択する。
    • イベントハンドラに以下のコードを記述する:
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;
  • プログラムを実行すると、以下のように見えるだろう:

ExampleTCheckGroup.png

Accessing the Check Boxes

Each item in the TCheckGroup has a Checked property, to set them all to checked do

for i := 0 to MyCheckGroup.items.Count-1 do   // check all the categories we found.
    MyCheckGroup.Checked[i] := true;

You can add items at run time by using TCheckGroup.Items, its a TStrings list. To add an new checkbox to the set, just do MyCheckGroup.Items.add('CheckThis'); Similarly, to remove all items, clear the list, MyCheckGroup.Items.clear;

See also


LCL Components
Component Tab Components
Standard TMainMenu • TPopupMenu • TButton • TLabel • TEdit • TMemo • TToggleBox • TCheckBox • TRadioButton • TListBox • TComboBox • TScrollBar • TGroupBox • TRadioGroup • TCheckGroup • TPanel • TFrame • TActionList
Additional TBitBtn/ja • TSpeedButton/ja • TStaticText/ja • TImage/ja • TShape/ja • TBevel/ja • TPaintBox/ja • TNotebook/ja • TLabeledEdit/ja • TSplitter/ja • TTrayIcon/ja • TControlBar/ja • TFlowPanel/ja • TMaskEdit/ja • TCheckListBox/ja • TScrollBox/ja • TApplicationProperties/ja • TStringGrid/ja • TDrawGrid/ja • TPairSplitter/ja • TColorBox/ja • TColorListBox/ja • TValueListEditor/ja
Common Controls TTrackBar • TProgressBar • TTreeView • TListView • TStatusBar • TToolBar • TCoolBar • TUpDown • TPageControl • TTabControl • THeaderControl • TImageList • TPopupNotifier • TDateTimePicker
Dialogs TOpenDialog • TSaveDialog • TSelectDirectoryDialog • TColorDialog • TFontDialog • TFindDialog • TReplaceDialog • TTaskDialog • TOpenPictureDialog • TSavePictureDialog • TCalendarDialog • TCalculatorDialog • TPrinterSetupDialog • TPrintDialog • TPageSetupDialog
Data Controls TDBNavigator/ja • TDBText/ja • TDBEdit/ja • TDBMemo/ja • TDBImage/ja • TDBListBox/ja • TDBLookupListBox/ja • TDBComboBox/ja • TDBLookupComboBox/ja • TDBCheckBox/ja • TDBRadioGroup/ja • TDBCalendar/ja • TDBGroupBox/ja • TDBGrid/ja • TDBDateTimePicker/ja
Data Access TDataSource/ja • TCSVDataSet/ja • TSdfDataSet/ja • TBufDataset/ja • TFixedFormatDataSet/ja • TDbf/ja • TMemDataset/ja
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 • TJSONPropStorage • TIDEDialogLayoutStorage • TMRUManager • TStrHolder
LazControls TCheckBoxThemed • TDividerBevel • TExtendedNotebook • TListFilterEdit • TListViewFilterEdit • TLvlGraphControl • TShortPathEdit • TSpinEditEx • TFloatSpinEditEx • TTreeFilterEdit • TExtendedTabControl •
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/ja • TSQLTransaction/ja • TSQLScript • TSQLConnector • TMSSQLConnection • TSybaseConnection • TPQConnection • TPQTEventMonitor • TOracleConnection • TODBCConnection • TMySQL40Connection • TMySQL41Connection • TMySQL50Connection • TMySQL51Connection • TMySQL55Connection • TMySQL56Connection • TMySQL57Connection • TSQLite3Connection/ja • 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 • TIpHtmlDataProvider • TIpHttpDataProvider • TIpHtmlPanel
Virtual Controls TVirtualDrawTree • TVirtualStringTree • TVTHeaderPopupMenu