Subject | RE: [IBO] Re: Lookup Combo with NULL |
---|---|
Author | Calin Pirtea |
Post date | 2005-09-08T06:28:55Z |
Hi Alan,
What I sometimes do with Lookup combos is to give the column name a description like "No Value" and show the title in the drop down.
Change the Fixed colour of the drop down to clWindow and it will look like a normal record without any fiddling around.
All you'll have to do is in the grid used as a drop down grid to place some code in the title click event that clears the field value.
Example:
procedure Tform1.YourGridTitleClick(Sender: TObject; ACol,
ARow: Integer; AButton: TMouseButton; AShift: TShiftState);
begin
inherited;
YourQuery.First;
if not YourQuery.Bof then
YourQuery.Prior;
FocusControl(YourLookup);
YourGrid.Visible := False;
end;
YourLookup(TIB_LookupCombo) has a property called CustomPopup which you have to assign to YourGrid.
YourGrid will be a normal grid that shows the title of the column but no row indicator to make it look like the generic drop down grid.
Both the grid and the lookup will point to the lookup dataset.
Cheers,
Calin Pirtea
COMMUNICARE DEVELOPMENT TEAM
Communicare Systems Pty Ltd
Australia
+61 (8) 9332 2433
+61 (4) 19 906 150
+61 (8) 9310 1516 (fax)
What I sometimes do with Lookup combos is to give the column name a description like "No Value" and show the title in the drop down.
Change the Fixed colour of the drop down to clWindow and it will look like a normal record without any fiddling around.
All you'll have to do is in the grid used as a drop down grid to place some code in the title click event that clears the field value.
Example:
procedure Tform1.YourGridTitleClick(Sender: TObject; ACol,
ARow: Integer; AButton: TMouseButton; AShift: TShiftState);
begin
inherited;
YourQuery.First;
if not YourQuery.Bof then
YourQuery.Prior;
FocusControl(YourLookup);
YourGrid.Visible := False;
end;
YourLookup(TIB_LookupCombo) has a property called CustomPopup which you have to assign to YourGrid.
YourGrid will be a normal grid that shows the title of the column but no row indicator to make it look like the generic drop down grid.
Both the grid and the lookup will point to the lookup dataset.
Cheers,
Calin Pirtea
COMMUNICARE DEVELOPMENT TEAM
Communicare Systems Pty Ltd
Australia
+61 (8) 9332 2433
+61 (4) 19 906 150
+61 (8) 9310 1516 (fax)