Subject | Re: [IBO] Set the readonly-flag to prevent from editing some fields in a IB_Grid |
---|---|
Author | C.Stahlberger |
Post date | 2007-02-09T07:47:13Z |
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
Hi Helen,
thanks, works fine.
Readonly is a "read-Only" property.
Actual exception was "you can't change values of read-only properties"
Greetings Christian
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
Hi Helen,
thanks, works fine.
Readonly is a "read-Only" property.
Actual exception was "you can't change values of read-only properties"
Greetings Christian
----- Original Message -----
From: Helen Borrie
To: IBObjects@yahoogroups.com
Sent: Friday, February 09, 2007 12:37 AM
Subject: Re: [IBO] Set the readonly-flag to prevent from editing some fields in a IB_Grid
At 01:07 AM 9/02/2007, you wrote:
>Hi,
>
>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?
Have you tried setting the FieldsReadOnly structure of the dataset?
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
___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !
Yahoo! Groups Links
[Non-text portions of this message have been removed]