On 10/03/2016 09:48 AM, Martin Schreiber wrote:
>
> Please explain. There should be no randomness.
>
> Martin
>
I use this procedure to load the stringgrid (see end of post)
It is called in the form oncreated event handler.
There is no blank first row.
If the following sequence is performed then there is a blank row in the
stringgrid.
a row is clicked for selection.
a delete button is pressed to delete the selected row.
the record is deleted from the database.
the DolbLookupsTypesOnChange procedure is called. A blank row is shown
in the stringgrid.
-------------------
procedure tmainfo.DolbLookupsTypesOnChange(const sender: TObject;
const Connect : boolean);
var
s : array [0..1] of msestring;
sType : string;
sQuery : msestring;
begin
sType := lbLookupsTypes.value;
sQuery := 'Select * from lookups where lupType = '''
+ sType + ''' order by lupValue';
with commonmo.qryReadOnly
do begin
sql.clear;
params.clear;
sql.add (sQuery);
end;
if Connect = true
then commonmo.dbAppointments.connected := true;
commonmo.qryReadOnly.active := true;
// load string grid
sgLookupsValues.rowcount := 0;
sgLookupsValues.beginupdate;
while commonmo.qryReadOnly.eof = false
do begin
with commonmo.qryReadOnly
do begin
s [0] := fieldbyname ('lupValue').asstring;
s [1] := fieldbyname ('lupId').asstring;
sgLookupsValues.appendrow (s);
next;
end;
end;
sgLookupsValues.endupdate;
commonmo.qryReadOnly.active := false;
if Connect = true
then commonmo.dbAppointments.connected := false;
sgLookupsValues.row := 0;
seLookupsValue.value := sgLookupsValues.datacols [0] [0];
end;
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk