Working with Zones (C++ Builder 6.0)
Take the following steps to add code to the existing project that will let you recognize pages:
1. |
Start with the program you created in Working with Pages |
|
2. |
From the ActiveX tab, Select and Add LTZoneData control to your form. |
|
3. |
Add 3 buttons to your form and name them as follows: |
|
|
Name |
Caption |
|
btnFindZones |
Find Zones |
|
btnZonesCount |
Zones Count |
|
btnVerifyZone |
Verify Zone |
4. |
Handle the LTZoneData OnVerification event, and code the LTZoneData1Verification procedure as follows: |
void __fastcall TForm1::LTZoneData1Verification(TObject *Sender,
short iZoneIndex, BSTR bstrWord)
{
LTZoneData1->set_VerifyCode ( VF_ACCEPT );
LTZoneData1->set_StopVerificationEvent ( False );
}
5. |
Code the btnFindZones button's click procedure as follows: |
void __fastcall TForm1::btnFindZonesClick(TObject *Sender)
{
int nRet;
LEADRasterDocument1->GetAutoZoneOptions ( );
LEADRasterDocument1->set_EnableZoneForceSingleColumn( True );
LEADRasterDocument1->set_ShowZoneGridLines( True );
LEADRasterDocument1->SetAutoZoneOptions ( );
nRet= LEADRasterDocument1->FindZones ( 0, True );
if ( nRet == 0 )
ShowMessage ( "Automatic zones method finds all available zones into the specified pages successfully" );
else
ShowMessage ( "Error" + IntToStr(nRet) + "in finding available zone in the specified page" );
}
6. |
Code the btnZonesCount button's click procedure as follows: |
void __fastcall TForm1::btnZonesCountClick(TObject *Sender)
{
int nZoneCount;
nZoneCount= LEADRasterDocument1->ZoneCount [0];
ShowMessage ( "Total Zones count = " + IntToStr(nZoneCount) );
}
7. |
Code the btnVerifyZone button's click procedure as follows: |
void __fastcall TForm1::btnVerifyZoneClick(TObject *Sender)
{
int i;
int nRet;
int nZoneCount;
nZoneCount= LEADRasterDocument1->ZoneCount [0];
for ( i= 0; i < nZoneCount; i ++ )
{
nRet= LEADRasterDocument1->GetZoneInfo ( 0, i, LTZoneData1->GetDefaultInterface ( ) );
if ( nRet == 0 )
{
if ((LTZoneData1->Flags & ZONE_CHK_CHECKCBF_PROHIBIT) == ZONE_CHK_CHECKCBF_PROHIBIT)
{
LTZoneData1->set_Flags( LTZoneData1->Flags & (! ZONE_CHK_CHECKCBF_PROHIBIT));
}
LTZoneData1->set_EnableVerificationEvent( True );
nRet= LEADRasterDocument1->UpdateZone ( 0, i, LTZoneData1->GetDefaultInterface ( ));
if ( nRet != 0 )
ShowMessage ( "Error" + IntToStr(nRet) + "in updating zone # " + IntToStr(i) );
}
}
}
8. |
Run your program to test it. |
9. |
Save the project to use as a starting point for other tasks in this tutorial. |