RYOFilterActivate

<< Click to Display Table of Contents >>

Navigation:  Apollo VCL Components > Apollo VCL Component Reference > TApolloTable > TApolloTable Methods >

RYOFilterActivate

Declaration

function RYOFilterActivate( iFilterHandle,

 iBoolOperation : Integer ) : WordBool;

Description

Activate an existing filter bitmap and either make it the filter bitmap of record or combine it with the current active bitmap.

Parameters

iFilterHandle: An integer identifier of the bitmap to be activated returned from either RYOFilterCopy or RYOFilterCreate.

iBoolOperation: One of the following manifest constants:

 

RYOFILTER_NEW  1

RYOFILTER_AND  2

RYOFILTER_OR  3

RYOFILTER_XOR  4

RYOFILTER_ANDNOT 5

RYOFILTER_ORNOT 6

RYOFILTER_XORNOT 7

 

RYOFILTER_NEW replaces any existing active bitmap.

 

For the bitwise boolean operations, every bit in the current filter bitmap is operated upon by its corresponding bit in the bitmap being activated. The bitwise operations give us the following results:

 

RYOFILTER_AND

Existing Bit Value

0

1

0

1

RYOFILTER_AND

1

1

0

0

Result

0

1

0

0

 

RYOFILTER_OR

Existing Bit Value

0

1

0

1

RYOFILTER_OR

1

1

0

0

Result

1

1

0

1

 

RYOFILTER_XOR

Existing Bit Value

0

1

0

1

RYOFILTER_XOR

1

1

0

0

Result

1

0

0

1

 

RYOFILTER_ANDNOT

Existing Bit Value

0

1

0

1

RYOFILTER_ANDNOT

1

1

0

0

Result

1

0

1

1

 

RYOFILTER_ORNOT

Existing Bit Value

0

1

0

1

RYOFILTER_ORNOT

1

1

0

0

Result

0

0

1

0

 

RYOFILTER_XORNOT

Existing Bit Value

0

1

0

1

RYOFILTER_XORNOT

1

1

0

0

Result

0

1

1

0

 

The NOT operations apply the boolean bitwise operation on the bits and then invert the result.

Return Value

True or False depending on the outcome of the operation.

Delphi Example

procedure TForm1.Button1Click(Sender: TObject);

begin

 if Button1.Caption = 'Activate Filter' then 

 begin 

         ApTbl.RYOFilterActivate( hBitMap, RYOFILTER_NEW );

         Button1.Caption := 'Clear Filter'; 

 end 

 else 

 begin 

         // Deactivate active bitmap; does not destroy it 

         ApTbl.RYOFilterDestroy( 0 );  

         // Destroys bitmap, freeing allocated memory

         ApTbl.RYOFilterDestroy( hBitMap );  

         // Create new, empty bitmap

         hBitMap := ApTbl.RYOFilterCreate;  

         Button1.Caption := 'Activate Filter'; 

 end; 

 ApTbl.First; 

 ApTbl.Refresh; 

end;

C++Builder Example

void __fastcall TForm1::Button1Click(TObject *Sender)

{

 if (Button1->Caption == "Activate Filter" ) 

 

         ApTbl->RYOFilterActivate( hBitMap, RYOFILTER_NEW );

         Button1->Caption = "Clear Filter"; 

 

 else 

 

         // Deactivate active bitmap; does not destroy it  

         ApTbl->RYOFilterDestroy( 0 );  

         // Destroys bitmap, freeing allocated memory  

         ApTbl->RYOFilterDestroy( hBitMap );  

         // Create new, empty bitmap  

         hBitMap = ApTbl->RYOFilterCreate();  

         Button1->Caption = "Activate Filter"; 

ApTbl->First(); 

ApTbl->Refresh(); 

}

See Also

RYOFilterCopy, RYOFilterCreate, RYOFilterDestroy, RYOFilterRestore, RYOFilterSave, RYOFilterSetBit