Difference between revisions of "TSplitter/fr"

From Lazarus wiki
Jump to navigationJump to search
Line 52: Line 52:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
==Splitter with AnchorSides==
+
= Splitter avec AnchorSides =
 
Anchor sides allows more fine tuned layouts. Align fills all the space. AnchorSides allow to anchor controls to any other sibling control.
 
Anchor sides allows more fine tuned layouts. Align fills all the space. AnchorSides allow to anchor controls to any other sibling control.
  
===Design time===
+
== En conception ==
 
#create a new [[TForm|form]]
 
#create a new [[TForm|form]]
 
#drop a [[TMemo]] on a form (left click on the TMemo icon in component paletter to select, then left click on the form)
 
#drop a [[TMemo]] on a form (left click on the TMemo icon in component paletter to select, then left click on the form)
Line 68: Line 68:
 
#anchor the left side of Memo2 to Splitter1. Make sure to anchor to the right side of Splitter1 (the button on the Anchor editor below the combobox).
 
#anchor the left side of Memo2 to Splitter1. Make sure to anchor to the right side of Splitter1 (the button on the Anchor editor below the combobox).
  
===Run time===
+
== A l'exécution ==
 
Vous pouvez aussi réaliser les mêmes actions comne ci-dessus par le code au lieu de le faire avec l'inspecteur d'objet en conception :
 
Vous pouvez aussi réaliser les mêmes actions comne ci-dessus par le code au lieu de le faire avec l'inspecteur d'objet en conception :
 
<syntaxhighlight>
 
<syntaxhighlight>

Revision as of 07:02, 19 September 2017

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

Un TSplitter tsplitter.png est un composant qui peut être placé sur un panneau ou une fiche telle une barre horizontale ou verticale pour séparer fonctionnellement deux panneaux.

Le contrôle pet être utilisa comme un séparateur visuel entre deux moitié de votre fiche et permet à l'utilisateur de votre application de la déplacer soit horizontalement soit verticalement. Il se trouve onglet Additional de la palette de composant.

TSplitter peut fonctionner basiquement dans deux modes différents : via Align (manière Delphi) ou via AnchorSides (manière différente).

Splitter et Align

La propriété Align peut être utilisé pour de simples agencements comme deux contrôles ou un lignes de contrôles. Par exemple quand vous avez besoin de quelques contrôles librement redimensionnables tels un mémo et un ListBox.

L'exemple suivant vous montre comment.

En conception

  1. créez une nouvelle fiche
  2. Placez un TMemo sur la fiche (clic gauche sur l'icône du TMemo dans la palette de composant pour le sélectionner, puis clic gauche sur la fiche).
  3. Dans l'inspecteur d'objet définissez la propriété Align du Memo1 à alLeft.
  4. Placez un TSplitter suer la fiche.
  5. L'alignement par défaut est déjà alLeft.
  6. Placez un autre TMemo sur la fiche.
  7. Dans l'inspecteur d'objet définissez la propriété Align du Memo2 à alClient.

A l'exécution

Vous pouvez aussi réaliser cela par code au lieu de le faire en conception :

procedure TMainForm.FormCreate(Sender: TObject);
var
  Memo1: TMemo;
  Splitter1: TSplitter;
  Memo2: TMemo;
begin
  Memo1:=TMemo.Create(Self);
  with Memo1 do begin
    Name:='Memo1';
    Parent:=Self;
    Align:=alLeft;
  end;
  Splitter1:=TSplitter.Create(Self);
  with Splitter1 do begin
    Name:='Splitter1';
    Parent:=Self;
    Left:=1; // position it right of Memo1
    Align:=alLeft;
  end;
  Memo2:=TMemo.Create(Self);
  with Memo2 do begin
    Name:='Memo2';
    Parent:=Self;
    Align:=alClient;
  end;
end;

Splitter avec AnchorSides

Anchor sides allows more fine tuned layouts. Align fills all the space. AnchorSides allow to anchor controls to any other sibling control.

En conception

  1. create a new form
  2. drop a TMemo on a form (left click on the TMemo icon in component paletter to select, then left click on the form)
  3. set in Object Inspector Align of Memo1 to alLeft
  4. drop a TSplitter on a form
  5. set the Align property of the Splitter1 to alNone
  6. select the Memo1
  7. View -> Anchor Editor
  8. anchor the right side of Memo1 to the Splitter1
  9. drop another TMemo on the form.
  10. set the Align property of Memo2 to alRight.
  11. anchor the left side of Memo2 to Splitter1. Make sure to anchor to the right side of Splitter1 (the button on the Anchor editor below the combobox).

A l'exécution

Vous pouvez aussi réaliser les mêmes actions comne ci-dessus par le code au lieu de le faire avec l'inspecteur d'objet en conception :

procedure TMainForm.FormCreate(Sender: TObject);
var
  Memo1: TMemo;
  Splitter1: TSplitter;
  Memo2: TMemo;
begin
  Memo1:=TMemo.Create(Self);
  with Memo1 do begin
    Name:='Memo1';
    Parent:=Self;
    Align:=alLeft;
  end;
  Splitter1:=TSplitter.Create(Self);
  with Splitter1 do begin
    Name:='Splitter1';
    Parent:=Self;
    Align:=alNone;
    Left:=100; // some value
    AnchorParallel(akBottom,0,Parent);
  end;
  Memo1.AnchorToNeighbour(akRight,0,Splitter1);
  Memo2:=TMemo.Create(Self);
  with Memo2 do begin
    Name:='Memo2';
    Parent:=Self;
    Align:=alRight;
    AnchorToNeighbour(akLeft,0,Splitter1);
  end;
end;

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