//--------------------------------------------------------------------------- #include #pragma hdrstop #include "MainForm.h" #include "Hyperlink.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" #pragma warn -8080 THyperlinkForm *HyperlinkForm; //--------------------------------------------------------------------------- __fastcall THyperlinkForm::THyperlinkForm(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall THyperlinkForm::Button2Click(TObject *Sender) { switch (nType) { case ANNLINK_RUN: szLink= Edit1->Text; break; case ANNLINK_WEBPAGE: szLink= Edit2->Text; break; default: szLink= NULL; } } //--------------------------------------------------------------------------- void THyperlinkForm::InitTheForm(int nType, L_HANDLE hObject) { char * pText; int nSize; switch (nType) { case ANNLINK_NONE: { NoneRadioButton->Checked= true; Edit1->Text = ""; Edit2->Text = ""; } break; case ANNLINK_ANNEVENT: { EventRadioButton->Checked= true; Edit1->Text = ""; Edit2->Text = ""; } break; case ANNLINK_RUN: { // get the size of the string nSize= MainFrm->LEADAnnCtrl1->AnnGetHyperlinkString(hObject, NULL); if ( nSize > 0 ) { /* allocate memory for string */ if ((pText = (char *) malloc(nSize)) == NULL) { ShowMessage("Not enough memory to allocate buffer\n"); exit(1); /* terminate program if out of memory */ } MainFrm->LEADAnnCtrl1->AnnGetHyperlinkString(hObject, &pText); Edit1->Text= pText; RunRadioButton->Checked= true; free( pText ) ; } } break; case ANNLINK_WEBPAGE: { // get the size of the string nSize= MainFrm->LEADAnnCtrl1->AnnGetHyperlinkString(hObject, NULL); if ( nSize > 0 ) { /* allocate memory for string */ if ((pText = (char *) malloc(nSize)) == NULL) { ShowMessage("Not enough memory to allocate buffer\n"); exit(1); /* terminate program if out of memory */ } MainFrm->LEADAnnCtrl1->AnnGetHyperlinkString(hObject, &pText); Edit2->Text= pText; WebPageRadioButton->Checked= true; free (pText); } } break; } HyperlinkForm->nType= nType; } void __fastcall THyperlinkForm::NoneRadioButtonClick(TObject *Sender) { nType= ANNLINK_NONE; Edit1->Enabled= false; Edit1->ParentColor= true; Edit2->Enabled= false; Edit2->ParentColor= true; } //--------------------------------------------------------------------------- void __fastcall THyperlinkForm::EventRadioButtonClick(TObject *Sender) { nType= ANNLINK_ANNEVENT; Edit1->Enabled= false; Edit1->ParentColor= true; Edit2->Enabled= false; Edit2->ParentColor= true; } //--------------------------------------------------------------------------- void __fastcall THyperlinkForm::RunRadioButtonClick(TObject *Sender) { nType= ANNLINK_RUN; Edit1->ParentColor= false; Edit1->Enabled= true; Edit2->ParentColor= true; Edit2->Enabled= false; } //--------------------------------------------------------------------------- void __fastcall THyperlinkForm::WebPageRadioButtonClick(TObject *Sender) { nType= ANNLINK_WEBPAGE; Edit1->ParentColor= true; Edit1->Enabled= false; Edit2->ParentColor= false; Edit2->Enabled= true; } //---------------------------------------------------------------------------