View Revisions: Issue #36035

Summary 0036035: Create "EmptyValue" and "DisplayEmpty" properties for TBLookupCombobox and TDBLookupListBox components
Revision 2020-04-24 01:02 by Juha Manninen
Description I am porting my existing old D5/D7 project to lazarus/fpc. I have a lot of TRxDBLookupCombo and TRXDBLookupListBox components, for most of the user selections for various data input (business forms and report parameters).
Delphi TRxDBLookupCombo and TRXDBLookupListBox I am converting to LCL TDBLookupComboBox and TDBLookupListBox components, everything is fine.
But, there is in the TRxDBLookupCombo and TRXDBLookupListBox functionality, do display an empty value, when the user does not want to select any of the values, that are in existing data into lookup data set.
It is very useful in my project, when the user must select some of the value into lookup data set, or some other different value, which will cover for example "All values".

Small example:
Let have a small database list of values table, called "roomstypes" with a fields "roomtypeid", "roomtypename" with a values 1 - One bed room, 2 - Two beds room and 3 - Apartment.
 If I must develop a report for accomodations, with an option to select some of the room type or "all rooms type", I am setting a "DisplayEmpty" property of RXDbLookupCombo to "All room types" and "EmptyValue" property to -1. In that case, on my report generation I am checking if keyvalue=emptyvalue, which means, that the user select "All room types" into RX DB lookup combo box.

I develop this missing functionality for TBLookupComboBox and TDBLookupListBox, by creating properties "DisplayEmpty" and "EmptyValue" into TDBLookup, TDBLookupCombobox and TDBLookupListBox components, and change FetchLookup method inside a TDBLookup class, by adding following code:

    if FEmptyValue<>'' then begin
      KeyIndex := FControlItems.Add(FDisplayEmpty);
      SetLength(FListKeys, ListLinkDataSet.RecordCount+1); // Add one more
      FListKeys[KeyIndex] := FEmptyValue;
      KeyListCount := 1;
    end;

Which handles filleng of the object.

I am creating svn patch diff file, .7z archive with a full unit changes, and small testing project, which uses new functionallity.
Revision 2019-09-01 10:28 by Zdravko Gabrovski
Description I am porting my existing old D5/D7 project to lazarus/fpc. I have a lot of TRxDBLookupCombo and TRXDBLookupListBox components, for most of the user selections for various data input (business forms and report parameters).
Delphi TRxDBLookupCombo and TRXDBLookupListBox I am converting to LCL TDBLookupComboBox and TDBLookupListBox components, everything is fine.
But, there is in the TRxDBLookupCombo and TRXDBLookupListBox functionality, do display an empty value, when the user does not want to select any of the values, that are in existing data into lookup data set.
It is very useful in my project, when the user must select some of the value into lookup data set, or some other different value, which will cover for example "All values".

Small example:
Let have a small database list of values table, called "roomstypes" with a fields "roomtypeid", "roomtypename" with a values 1 - One bed room, 2 - Two beds room and 3 - Apartment.
 If I must develop a report for accomodations, with an option to select some of the room type or "all rooms type", I am setting a "DisplayEmpty" property of RXDbLookupCombo to "All room types" and "EmptyValue" property to -1. In that case, on my report generation I am checking if keyvalue=emptyvalue, which means, that the user select "All room types" into RX DB lookup combo box.

I develop this missing functionality for TBLookupComboBox and TDBLookupListBox, by creating properties "DisplayEmpty" and "EmptyValue" into TDBLookup, TDBLookupCombobox and TDBLookupListBox components, and change FetchLookup method inside a TDBLookup class, by adding following code:

    if FEmptyValue<>'' then begin
      KeyIndex := FControlItems.Add(FDisplayEmpty);
      SetLength(FListKeys, ListLinkDataSet.RecordCount+1); // Add one more
      FListKeys[KeyIndex] := FEmptyValue;
      KeyListCount := 1;
    end;

Which handles filleng of the object.

I am creating svn patch diff file, .7z archive with a full unit changes, and small testing project, which uses new functionallity.