Subject | RE: [IBO] DrawCell method query |
---|---|
Author | Alan McDonald |
Post date | 2003-02-04T08:01:23Z |
thanks Lester,
no my fields are all populated - they are not null boolean Y/N fields
I have since found that
if (IB_Query1.BufferFields[4].AsString='Y') then
works where
if (IB_Query1.BufferFieldByName('myboolfield').AsBoolean='Y') then
does not
Not sure why... any clues?
secondly
what is the difference between using the DrawCell event and the GetCellProps
event for doing this task?
Why is there a DrawCell and DrawFocusedCell when you can test for focused
state in the DrawCell event anyway?
thanks
Alan
-----Original Message-----
From: Lester Caine [mailto:lester@...]
Sent: Tuesday, 4 February 2003 6:44 PM
To: IBObjects@yahoogroups.com
Subject: Re: [IBO] DrawCell method query
If some of the entries are still NULL that could be causing
a problem.
I use a more complex version of this, where a hidden state
column gives me an integer to select the colour for the
whole row, and it works well.
//--------------------------------------------------------------------------
-
void __fastcall TMainForm::ServeGridGetCellProps(TObject
*Sender, int ACol,
int ARow, TGridDrawState AState, TColor &AColor,
TFont *AFont)
{ if ( !ACol || !ARow ) return;
if ( Data->SERVE && Data->SERVE->Active )
{ int BufferRowNum = ServeGrid->DataRow[ ARow ];
if ( BufferRowNum > 0 )
{ Data->INITIAL->BufferRowNum = BufferRowNum;
int wait = -99;
{ if (
Data->SERVE->BufferFieldByName("TWAIT")->IsNotNull )
wait =
Data->SERVE->BufferFieldByName("TWAIT")->AsInteger;
}
This gives me a stable 'TWAIT' what ever I have done with it
in the database <g>
--
Lester Caine
-----------------------------
L.S.Caine Electronic Services
___________________________________________________________________________
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 !
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
no my fields are all populated - they are not null boolean Y/N fields
I have since found that
if (IB_Query1.BufferFields[4].AsString='Y') then
works where
if (IB_Query1.BufferFieldByName('myboolfield').AsBoolean='Y') then
does not
Not sure why... any clues?
secondly
what is the difference between using the DrawCell event and the GetCellProps
event for doing this task?
Why is there a DrawCell and DrawFocusedCell when you can test for focused
state in the DrawCell event anyway?
thanks
Alan
-----Original Message-----
From: Lester Caine [mailto:lester@...]
Sent: Tuesday, 4 February 2003 6:44 PM
To: IBObjects@yahoogroups.com
Subject: Re: [IBO] DrawCell method query
> I want to draw over the top of an IB_Grid cell.rectangle
> I set the default drawvrfore to true since I want to draw a color
> marker in the cell depending on the value of an invisible field in thedoes
> query.
> At first I was using
> if (IB_Query1.BufferFieldNyName('myfield').AsBoolean='Y') then
> Draw the rectangle
>
> This worked at first but now I get AV's since it apears that the buffer
> not have the field in question all the time (when I need it). So I needgrid
> another method of accessing the field value of a record on the current
> row (which is not visible).not
> I've seen the drawcell code but it only queries the Cell[ARow, ACol] and
> the contents of an invisible field.The first question would be - Is 'myfield' always populated?
> Can someone lead me to the answer please?
If some of the entries are still NULL that could be causing
a problem.
I use a more complex version of this, where a hidden state
column gives me an integer to select the colour for the
whole row, and it works well.
//--------------------------------------------------------------------------
-
void __fastcall TMainForm::ServeGridGetCellProps(TObject
*Sender, int ACol,
int ARow, TGridDrawState AState, TColor &AColor,
TFont *AFont)
{ if ( !ACol || !ARow ) return;
if ( Data->SERVE && Data->SERVE->Active )
{ int BufferRowNum = ServeGrid->DataRow[ ARow ];
if ( BufferRowNum > 0 )
{ Data->INITIAL->BufferRowNum = BufferRowNum;
int wait = -99;
{ if (
Data->SERVE->BufferFieldByName("TWAIT")->IsNotNull )
wait =
Data->SERVE->BufferFieldByName("TWAIT")->AsInteger;
}
This gives me a stable 'TWAIT' what ever I have done with it
in the database <g>
--
Lester Caine
-----------------------------
L.S.Caine Electronic Services
___________________________________________________________________________
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 !
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/