Subject | SV: [IBO] dataset with boolean |
---|---|
Author | Harvey R Shaw |
Post date | 2005-04-25T07:45:14Z |
Thanks for your input Andreas.
First solution from Salvatore works fine in DataSets onDataChange.
I would like to have Lookup change to a value for NOT RELEVANT or default for relevant before scrolling to new record in grid (before posting), but it doesn't seem possible to update the LookupCombo before the post. In the Master querys beforePost I set the Master querys value the Lookup will use. Thereby the LookUp for the previous record in grid is updated (after posting), but a bit later than what we'd like.
Regards
Harvey
First solution from Salvatore works fine in DataSets onDataChange.
I would like to have Lookup change to a value for NOT RELEVANT or default for relevant before scrolling to new record in grid (before posting), but it doesn't seem possible to update the LookupCombo before the post. In the Master querys beforePost I set the Master querys value the Lookup will use. Thereby the LookUp for the previous record in grid is updated (after posting), but a bit later than what we'd like.
Regards
Harvey
> -----Oprindelig meddelelse-----
> Fra: IBObjects@yahoogroups.com
> [mailto:IBObjects@yahoogroups.com] På vegne af Andreas Hesse
> Sendt: 14. april 2005 10:31
> Cc: IBObjects@yahoogroups.com
> Emne: Re: [IBO] dataset with boolean
>
>
> Salvatore Besso wrote:
> > hello Harvey,
> >
> > maybe you can use an AfterScroll event for your query:
> >
> > begin
> > MyLookupCombo.Enabled := MyQuery.FieldByName('RELEVANT').AsBoolean
> > end;
> >
> > Remember that to use the AsBoolean property you have to define that
> > field as Boolean in the ColumnAttributes property of the query:
> >
> > RELEVANT=BOOLEAN
> >
> > or, if you want to specify also the Boolean values the
> field can assume:
> >
> > RELEVANT=BOOLEAN=1;0
> >
> > or
> >
> > RELEVANT=BOOLEAN=T;F
> >
> > or whatever... The True value is the first.
> >
> > HTH
> > Salvatore
> >
>
> Or you work with properties of the column.
> If the column is readonly you can open the combobox but you
> cannot change the value.
> So write an AfterScroll event, for example:
> procedure DataAfterScroll(IB_Dataset: TIB_Dataset); var
> col1,col2: TIB_Column; begin
> col1 := IB_Dataset.FindField('Relevant');
> col2 := IB_Dataset.FindField('LookupKeyField');
> if Assigned(col1) and Assigned(col2) then begin
> col2.ReadOnly := col1.AsBoolean;
> end;
> end;
>
> And don't forget to write an AfterInsert event to enable the
> column there for inserts (like code above, but only with
> col2.ReadOnly := false;).
>
> To make sure that nobody could change the lookupKeyField you
> can write a Before Update Trigger.
>
> Andreas
>
>
>
> ______________________________________________________________
> _____________
> 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
>
>
>
>
>
>
>
>
>
>