home *** CD-ROM | disk | FTP | other *** search
- //---------------------------------------------------------------------------
- #include <vcl\vcl.h>
- #pragma hdrstop
-
- #include "Prompt.h"
- //---------------------------------------------------------------------------
- #pragma resource "*.dfm"
- TMainForm *MainForm;
- //---------------------------------------------------------------------------
- __fastcall TMainForm::TMainForm(TComponent* Owner)
- : TForm(Owner)
- {
- }
- //---------------------------------------------------------------------------
- void __fastcall TMainForm::PreviewClick(TObject *Sender)
- {
- if (Type->ItemIndex == 0) Application->MessageBox(Message->Text.c_str(), "Browser Name",MB_OKCANCEL+MB_ICONQUESTION+MB_DEFBUTTON1+MB_SYSTEMMODAL);
- else Application->MessageBox(Message->Text.c_str(), "Browser Name",MB_OK+MB_ICONEXCLAMATION+MB_DEFBUTTON1+MB_SYSTEMMODAL);
- }
- //---------------------------------------------------------------------------
- void __fastcall TMainForm::InsertClick(TObject *Sender)
- {
- if (Type->ItemIndex == 0) CodeString = "window.confirm('";
- else CodeString = "window.alert('";
-
- AnsiString MessageString = "";
- int Line = 0;
- while (Line < Message->Lines->Count)
- {
- MessageString = MessageString + Message->Lines->Strings[Line];
- if (Line < (Message->Lines->Count - 1)) MessageString = MessageString + "\\n";
- Line++;
- };
-
- CodeString += MessageString + "')";
-
- if (OnCancel->Enabled)
- {
- if (OnCancel->ItemIndex == 0) CodeString = "if (!" + CodeString + ") window.close();";
- else if (OnCancel->ItemIndex == 1) CodeString = "if (!" + CodeString + ") window.history.back();";
- else CodeString += ";";
- }
- else CodeString += ";";
-
- if (Code->Enabled && Code->ItemIndex == 0)
- {
- TSearchTypes Options;
- RichEdit->SelStart = RichEdit->FindText("<body", 0, RichEdit->Text.Length(), Options);
- RichEdit->SelLength = 5;
- if (RichEdit->SelText.AnsiCompareIC("<body") == 0)
- {
- int Start = RichEdit->SelStart;
- int End = RichEdit->FindText(">", Start, RichEdit->Text.Length(), Options);
- RichEdit->SelStart = RichEdit->FindText("onload=\"", Start, End, Options);
- RichEdit->SelLength = 8;
- if (RichEdit->SelText.AnsiCompareIC("onload=\"") == 0)
- {
- RichEdit->SelLength = RichEdit->FindText("\"", RichEdit->SelStart + 8, End, Options) - RichEdit->SelStart;
- }
- else
- {
- RichEdit->SelStart = End;
- RichEdit->SelLength = 0;
- RichEdit->SelText = " ";
- };
- RichEdit->SelText = "onload=\"" + CodeString + "\"";
- };
- };
- }
- //---------------------------------------------------------------------------
- void __fastcall TMainForm::TypeClick(TObject *Sender)
- {
- OnCancel->Enabled = (Type->ItemIndex == 0);
- }
- //---------------------------------------------------------------------------
- void __fastcall TMainForm::MessageChange(TObject *Sender)
- {
- Insert->Enabled = (Message->Text != "");
- Preview->Enabled = Insert->Enabled;
- }
- //---------------------------------------------------------------------------
-