//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop

#include "FDLGInsertHyperLink.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TDLGInsertHyperLink *DLGInsertHyperLink;

//---------------------------------------------------------------------------
bool dlg_bInsertHyperLink(THyperLinkProps& _roHyperLinkProps)
{
	bool bRes;
	Application->CreateForm(__classid(TDLGInsertHyperLink), &DLGInsertHyperLink);

    DLGInsertHyperLink->ed_Text->Text = _roHyperLinkProps.m_asText;
    DLGInsertHyperLink->ed_Link->Text = _roHyperLinkProps.m_asHyperLink;

	DLGInsertHyperLink->ShowModal();

	bRes = (DLGInsertHyperLink->ModalResult == mrOk);
	if (bRes)
	{
		_roHyperLinkProps.m_asText      = DLGInsertHyperLink->ed_Text->Text;
		_roHyperLinkProps.m_asHyperLink = DLGInsertHyperLink->ed_Link->Text;
	}

	delete DLGInsertHyperLink;
	return(bRes);
}
//---------------------------------------------------------------------------
__fastcall TDLGInsertHyperLink::TDLGInsertHyperLink(TComponent* Owner)	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TDLGInsertHyperLink::Button2Click(TObject *Sender)
{
	if (dlg_Open->Execute())
		ed_Link->Text = dlg_Open->FileName;
}
//---------------------------------------------------------------------------
void __fastcall TDLGInsertHyperLink::FormKeyDown(TObject *Sender, WORD &Key,TShiftState Shift)
{
	if (Key == VK_ESCAPE) ModalResult = mrCancel;
}
//---------------------------------------------------------------------------

