Subject | Re: [IBO] Set the readonly-flag to prevent from editing some fields in a IB_Grid |
---|---|
Author | Helen Borrie |
Post date | 2007-02-08T23:37:52Z |
At 01:07 AM 9/02/2007, you wrote:
with qryLagerBew do
begin
FieldsReadOnly.Clear;
for i := 0 to qryLagerBew.FieldCount - 1 do
begin
if ( ( qryLagerBew.Fields[i].FieldName <> 'LB_BUCHUNGSTEXT' )AND
( qryLagerBew.Fields[i].FieldName <> 'LB_VERP_MENGE' )AND
( qryLagerBew.Fields[i].FieldName <> 'LB_TEXT_INTERN' ) )
then FieldsReadOnly.Add(Fields[i].FieldName + '=T');
end; // for i
Note, you can also qualify the modes where you want the attribute to
apply, i.e.
acolumnname=T;NOEDIT;NOINSERT;NOSEARCH
bcolumnname=F;NOEDIT;NOINSERT
etc.
I have an idea that the ReadOnly property of a field is itself a
read-only property, considering that e.g. expression fields and
calculated fields are read-only by nature. Setting the
FieldsReadOnly property to F[alse] on such fields would cause an
exception at some point.
The dataset would need to be inactive and unprepared at the time
these changes were done.
What was the actual exception you saw?
Helen
>Hi,Have you tried setting the FieldsReadOnly structure of the dataset?
>
>i would like to set readonly in a ib_grid for some fields like this:
>
> for i := 0 to qryLagerBew.FieldCount - 1 do
> begin
> if ( ( qryLagerBew.Fields[i].FieldName <> 'LB_BUCHUNGSTEXT' )AND
> ( qryLagerBew.Fields[i].FieldName <> 'LB_VERP_MENGE' )AND
> ( qryLagerBew.Fields[i].FieldName <> 'LB_TEXT_INTERN' ) )
> then qryLagerBew.Fields[i].ReadOnly := true;
> end; // for i
>
>this way isn't accept by Delphi5. how to do it?
with qryLagerBew do
begin
FieldsReadOnly.Clear;
for i := 0 to qryLagerBew.FieldCount - 1 do
begin
if ( ( qryLagerBew.Fields[i].FieldName <> 'LB_BUCHUNGSTEXT' )AND
( qryLagerBew.Fields[i].FieldName <> 'LB_VERP_MENGE' )AND
( qryLagerBew.Fields[i].FieldName <> 'LB_TEXT_INTERN' ) )
then FieldsReadOnly.Add(Fields[i].FieldName + '=T');
end; // for i
Note, you can also qualify the modes where you want the attribute to
apply, i.e.
acolumnname=T;NOEDIT;NOINSERT;NOSEARCH
bcolumnname=F;NOEDIT;NOINSERT
etc.
I have an idea that the ReadOnly property of a field is itself a
read-only property, considering that e.g. expression fields and
calculated fields are read-only by nature. Setting the
FieldsReadOnly property to F[alse] on such fields would cause an
exception at some point.
The dataset would need to be inactive and unprepared at the time
these changes were done.
What was the actual exception you saw?
Helen