Difference between revisions of "TRadioGroup/ja"

From Free Pascal wiki
Jump to navigationJump to search
 
(3 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
{{ Japanese Menu }}
 
{{ Japanese Menu }}
  
A '''TRadioGroup''' [[image:tradiogroup.png]] is a group of related but mutually exclusive [[TRadioButton]]s, requiring the user to select one of a set of alternatives. It's like a [[TGroupBox]] with integrated [[TRadioButton|TRadioButtons]].
+
TRadioGroup[[image:tradiogroup.png]]は、関連するが相互に排他的な[[TRadioButton/ja|TRadioButton]]のグループであり、ユーザーに対して選択肢の1つを選択する必要がある。それは、統合された[[TRadioButton/ja |TRadioButtons]]を持つ[[TGroupBox/ja | TGroupBox]]のようなものである。
  
==Usage==
+
==使い方==
To use a TRadioGroup 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.
+
[[TForm|Form]]でTRadioGroupを使用するには、単純に[[Component Palette/ja|Componentパレット]][[Standard tab/ja|Standardタブ]]でそれを選択し、フォームをクリックして配置します。
  
===Small example===
+
======
Geometric figures should be drawn randomly and depending on the TRadioGroups to the form. The first RadioGroup determines the shape, the second RadioGroup detrmines the number.
+
ジオメトリック図形は、TRadioGroupによってフォームにランダムに描画され、表示される。最初のRadioGroupは図形を決定し、2番目のRadioGroupは個数を決定する。
* create a new application and place two TRadioGroups on your form
+
* 新しいアプリケーションを作成し、フォームに2つのTRadioGroupを配置する。
* change in the Object Inspector the [[Property|property]] ''Name'' of ''RadioGroup1'' to ''rgShape'', also ''RadioGroup2'' to ''rgCount''
+
* オブジェクトインスペクタで、''RadioGroup1''''Name''プロパティを''rgShape''に、''RadioGroup2''の''Name''プロパティを''rgCount''に変更する。
* change identical ''Caption'' of ''rgShape'' to ''Shape'' and that of ''rgCount'' to ''Count''
+
* ''rgShape''''Caption''''Shape''に、''rgCount''の''Caption''を''Count''に変更する。
* add the RadioButtons for ''rgShape'':
+
** ''rgShape''のためのラジオボタンを追加する:
** in the Object Inspector select the property ''Items'' of ''rgShape''
+
** オブジェクトインスペクタで、''rgShape''''Items''プロパティを選択する。
** click on the button [...], the character chain editor opens
+
** [...]ボタンをクリックすると、文字列エディタが開く。
** write among each other ''Lines Rectangles Ellipses'' and complete the entry with the button ''OK''
+
** それぞれ''Lines'', ''Rectangles'', ''Ellipses''と入力し、''OK''ボタンをクリックしてエントリを完了する。
* add identical the RadioButtons for ''rgCount'' (written among each other): ''1 5 10 20 50 100''
+
* ''rgCount''のためにも同様にラジオボタンを追加する(以下のように入力)1、5、10、20、50、100
* set the first RadioButton as the ''currently selected'', by setting the property ''ItemIndex'' of ''rgShape'' and ''rgCount'' from ''-1'' to ''0''
+
* ''rgShape''''rgCount''''ItemIndex''プロパティをそれぞれ''-1''から''0''に設定して、最初のRadioButtonを''currently selected''にする。
* create the ''OnClick'' event handler of ''rgShape'' by double clicking ''rgShape''
+
* ''rgShape''をダブルクリックして、''rgShape''''OnClick''イベントハンドラを作成する。
* also use these event handler for ''rgCount'':
+
* 同じイベントハンドラを''rgCount''にも使用する。
** in the Object Inspector select ''rgCount''
+
** オブジェクトインスペクタで''rgCount''を選択する。
** now select the tab ''Events'' in the Object Inspector
+
** ここで、オブジェクトインスペクタで''Events''タブを選択してください。
** go to the ''OnClick'' event and select in the adjacent ComboBox ''rgShapeClick''
+
** ''OnClick''イベントに移動し、隣のコンボボックスで''rgShapeClick''を選択する。
* whenever ''rgShape'' or ''rgCount'' is clicked, the form should be redrawn, therefore write following code in the event handler:
+
* ''rgShape''または''rgCount''がクリックされるたびに、フォームが再描画されるようにするために、次のコードをイベントハンドラに記述する:
 
<syntaxhighlight lang="pascal">
 
<syntaxhighlight lang="pascal">
 
procedure TForm1.rgShapeClick(Sender: TObject);
 
procedure TForm1.rgShapeClick(Sender: TObject);
Line 31: Line 31:
 
end;  
 
end;  
 
</syntaxhighlight>  
 
</syntaxhighlight>  
* whenever the form is redrawn, the shapes should be drawn:
+
* フォームが再描画されるたびに、図形を描画する必要がある。
** in the Object Inspector select ''Form1''
+
** オブジェクトインスペクタで ''Form1'' を選択する。
** select the tab ''Events''
+
** ''Events''タブを選択する。
** click on the button [...] next to the event ''OnPaint''
+
** ''OnPaint''イベントの横にある [...] ボタンをクリックする。
** the handler is created, enter the following code:
+
** ハンドラが作成される。以下のコードを入力する:
 
<syntaxhighlight lang="pascal">
 
<syntaxhighlight lang="pascal">
 
procedure TForm1.FormPaint(Sender: TObject);
 
procedure TForm1.FormPaint(Sender: TObject);
Line 53: Line 53:
 
end;
 
end;
 
</syntaxhighlight>
 
</syntaxhighlight>
* start your program, it could look like:
+
* プログラムを実行すると、以下のように見えるだろう:
 
 
 
[[image:ExampleTRadioGroup.png]]
 
[[image:ExampleTRadioGroup.png]]
  
==See also==
+
==以下も参照のこと==
 
* [[doc:lcl/extctrls/tradiogroup.html|TRadioGroup doc]]
 
* [[doc:lcl/extctrls/tradiogroup.html|TRadioGroup doc]]
* [[TRadioButton]]
+
* [[TRadioButton/ja]]
* [[TGroupBox]]
+
* [[TGroupBox/ja]]
  
 
{{LCL Components/ja}}
 
{{LCL Components/ja}}

Latest revision as of 09:37, 24 March 2024

Deutsch (de) English (en) suomi (fi) français (fr) 日本語 (ja) русский (ru)

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

TRadioGrouptradiogroup.pngは、関連するが相互に排他的なTRadioButtonのグループであり、ユーザーに対して選択肢の1つを選択する必要がある。それは、統合されたTRadioButtonsを持つ TGroupBoxのようなものである。

使い方

FormでTRadioGroupを使用するには、単純にComponentパレットStandardタブでそれを選択し、フォームをクリックして配置します。

ジオメトリック図形は、TRadioGroupによってフォームにランダムに描画され、表示される。最初のRadioGroupは図形を決定し、2番目のRadioGroupは個数を決定する。

  • 新しいアプリケーションを作成し、フォームに2つのTRadioGroupを配置する。
  • オブジェクトインスペクタで、RadioGroup1NameプロパティをrgShapeに、RadioGroup2NameプロパティをrgCountに変更する。
  • rgShapeCaptionShapeに、rgCountCaptionCountに変更する。
    • rgShapeのためのラジオボタンを追加する:
    • オブジェクトインスペクタで、rgShapeItemsプロパティを選択する。
    • [...]ボタンをクリックすると、文字列エディタが開く。
    • それぞれLines, Rectangles, Ellipsesと入力し、OKボタンをクリックしてエントリを完了する。
  • rgCountのためにも同様にラジオボタンを追加する(以下のように入力)1、5、10、20、50、100
  • rgShapergCountItemIndexプロパティをそれぞれ-1から0に設定して、最初のRadioButtonをcurrently selectedにする。
  • rgShapeをダブルクリックして、rgShapeOnClickイベントハンドラを作成する。
  • 同じイベントハンドラをrgCountにも使用する。
    • オブジェクトインスペクタでrgCountを選択する。
    • ここで、オブジェクトインスペクタでEventsタブを選択してください。
    • OnClickイベントに移動し、隣のコンボボックスでrgShapeClickを選択する。
  • rgShapeまたはrgCountがクリックされるたびに、フォームが再描画されるようにするために、次のコードをイベントハンドラに記述する:
procedure TForm1.rgShapeClick(Sender: TObject);
begin
  Repaint;
end;
  • フォームが再描画されるたびに、図形を描画する必要がある。
    • オブジェクトインスペクタで Form1 を選択する。
    • Eventsタブを選択する。
    • OnPaintイベントの横にある [...] ボタンをクリックする。
    • ハンドラが作成される。以下のコードを入力する:
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;
  • プログラムを実行すると、以下のように見えるだろう:

ExampleTRadioGroup.png

以下も参照のこと


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