Difference between revisions of "TValueListEditor"

From Lazarus wiki
Jump to navigationJump to search
Line 29: Line 29:
 
     procedure TForm1.ValueListEditorSelection(Sender: TObject; aCol, aRow: Integer);
 
     procedure TForm1.ValueListEditorSelection(Sender: TObject; aCol, aRow: Integer);
  
  Let's asume that you have changed focus from row 10 to row 4, by clicking on row 4. In this case, OnBeforeSelection is called first, and then OnSelection is called. Value of parameter aRow is 4 (index of newly selected row) in both procedures. But values of ValueListEditor.Row are different. It will return 10 within OnBeforeSelection, and 4 within OnSelection.
+
  Let's asume that you have changed focus from row 10 to row 4, by clicking on row 4.  
 +
In this case, OnBeforeSelection is called first, and then OnSelection is called. Value of parameter aRow is 4 (index of newly selected row) in both procedures.  
 +
But values of ValueListEditor.Row are different. It will return 10 within OnBeforeSelection, and 4 within OnSelection.
  
 
==See also==
 
==See also==

Revision as of 06:25, 23 August 2022

English (en) français (fr) русский (ru)

component-TValueListEditor.png

A TValueListEditor tvaluelisteditor.png is a component that provides a box with key-value-pairs that is user editable. It is available from the Additional tab of the Component Palette. A TValueListEditor acts similar as two-column TStringGrid.

The key-value-pairs are provided in the property Strings, a TValueListString type.

Counts and indices

TValueListEditor may have column head or column title row, which is similar to fixed row of TStringGrid. You can set this visible or not by setting doColumnTitles (this is in DisplayOptions) to true or false.

RowCount property is number of rows including title row.

There should be always one VISIBLE row except title row, even a blank row in TValueListEditor. So the minimum RowCount is 2 if column titles are visible, and 1 if column titles are not visible.

The content of TValueListEditor is stored in its Strings property. When there is only one blank row in the visible TValueListEditor, its Strings.Count=0.

So, the number of key-value-pairs is not exactly the same as RowCount. It is the same as Strings.count.

Index of currently selected row is returned as property Row (or you may set its value in the program). Assuming that column titles are visible, the index of first row just below column titles is 1.

Miscellanies

function InsertRow(const Key, Value:string;append:boolean): integer;

  • There is an append parameter. If set true, new row is inserted after current row, not at the end of whole list of pairs.
  • The returned function result value is index within Strings property. If column title row is visible, returned value is less than Row property by two.

Event handlers of OnBeforeSelection and OnSelection

 When you change selected row, OnBeforeSelection and OnSelection events may be called. Definitions are like:
    procedure TForm1.ValueListEditorBeforeSelection(Sender: TObject; aCol, aRow: Integer);
    procedure TForm1.ValueListEditorSelection(Sender: TObject; aCol, aRow: Integer);
Let's asume that you have changed focus from row 10 to row 4, by clicking on row 4. 
In this case, OnBeforeSelection is called first, and then OnSelection is called. Value of parameter aRow is 4 (index of newly selected row) in both procedures. 
But values of ValueListEditor.Row are different. It will return 10 within OnBeforeSelection, and 4 within OnSelection.

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 • 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 • TTaskDialog • TOpenPictureDialog • TSavePictureDialog • TCalendarDialog • TCalculatorDialog • TPrinterSetupDialog • TPrintDialog • TPageSetupDialog
Data Controls TDBNavigator • TDBText • TDBEdit • TDBMemo • TDBImage • TDBListBox • TDBLookupListBox • TDBComboBox • TDBLookupComboBox • TDBCheckBox • TDBRadioGroup • TDBCalendar • TDBGroupBox • TDBGrid • TDBDateTimePicker
Data Access TDataSource • TCSVDataSet • TSdfDataSet • TBufDataset • TFixedFormatDataSet • TDbf • TMemDataset
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 • TSQLTransaction • TSQLScript • TSQLConnector • TMSSQLConnection • TSybaseConnection • TPQConnection • TPQTEventMonitor • TOracleConnection • TODBCConnection • TMySQL40Connection • TMySQL41Connection • TMySQL50Connection • TMySQL51Connection • TMySQL55Connection • TMySQL56Connection • TMySQL57Connection • 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 • TIpHtmlDataProvider • TIpHttpDataProvider • TIpHtmlPanel
Virtual Controls TVirtualDrawTree • TVirtualStringTree • TVTHeaderPopupMenu