질문 많이 올리네요..ㅡㅡ
산넘어 산이니 이거...죽갔습니다..
다름이 아니라 ActiveForm에서 완료 버튼을 클릭하면 자바스크립트같은 함수를 호출해서 값을 넘기려고 합니다. 값은 스트링으로 4개가 넘어가구요..
이리저리 질답 찾아서 프로퍼티 생성과 메소드 생성을 했긴했는데요..
어디다가 값을 세팅해야 할지 모르겠네요..
예를 들어...
LiveFing이란 프로퍼티를 생성했습니다. 레지스트리 등록을 하니 아래와 같은 function과 procedure가 생기더군요.. 그렇다면 HTML로 넘길려고하는 값을 어디다 세팅해야 하나요?ㅡㅡ
function TJuminVerify.Get_LiveFing: OleVariant;
begin
//
end;
procedure TJuminVerify.Set_LiveFing(Value: OleVariant);
begin
//
end;
그리고, 메소드를 하나 생성했죠.. gTemp란 메소드로요.. 다음과 같이 생기더군요.. 뭘 코딩해야하는지..ㅡㅡ^
procedure TJuminVerify.gTemp();
begin
end;
정리를 하자면 프로퍼티 4개 만들고 메소드에서 자바스크립트 호출하면 자바스크립트에서 프로퍼티 4개를 가져갈 수 있다는건 알겠는데 어케 기술해야하는지 모르겠네요... ㅡㅡ
그리고, 자바스크립트 내용은 어케 기술해야하는지.. 도통 답이 나오질 않네요..
좀 질문 내용도 어지럽고 답해주시려면 써주셔야할 것두 많을 것 같은 생각이 드네요...
번거로우시고 귀찮으시더라도... 답변 부탁드립니다.. 꾸벅...(__)
어쨌든 매번 읽어봐주시고 답변 주신 분들께 감사드립니다...^^
http://www.howtodothings.com/showarticle.asp?article=111"
With the Delphi Active Form it is easy to create an ActiveX (OCX)
component what can be integrated into programs like VB, VBA
(Word, Excel, Access, and Outlook), Delphi, C++, and in this case
the IE Web-Browser via a HTML document.
From the Delphi IDE File | New menu, display the New Item dialog box,
and from the ActiveX tab select the Active Form option.
The Active Form creates a new Active Form, which is a simpler
ActiveX control (descended from the TActiveForm) pre-configured to
run in a Web Browser. The ActiveX Control Wizard appears to guide
you through the creation process, allowing you to add controls to
the form. The Wizard creates an ActiveX Library project (if needed),
a type library, a form, an implementation unit, and a unit containing
corresponding type library declarations.
Enter the New ActiveX Name in the Active Form Wizard. Change the
Implementation Unit name and Project name as needed.
Choose the threading model to indicate how COM serializes calls to
your ActiveX control.
Note: The threading model you choose determines how the object is
registered. You must make sure that your object implementation
adheres to the model selected.
Before activate the OK button check the required Control Options.
For more information use the Help button.
Add a property:
Display the projects xx_TLB.Pas file. From the Edit Window hit the
F12 to display the .Tlb form.
Under the Project you will find the Interface entry. If you expand
the entry you will see several pre-created properties. Right click
in the outline area and select the New | Property option. Two
Properties is added to the outline: The get and the put Property.
Enter the name and the type for the Properties.
In the protected area of the Class you will find a function and a
procedure matching the new Property. In the implementation section
you also will find the two functions and procedure. Add the
appropriated code to the function and the procedure.
function TActiveXtest1.Get_Entry: WideString;
begin
Result := EditEntry.Text; // Read the TEdit text
end;
procedure TActiveXtest1.Set_Entry(const Value: WideString);
begin
EditEntry.Text := Value; // Set the TEdit text
end;
Add an Event:
Open the Event section in the outline and right click. Select the
New | Method option. Give the Method a name like OnSubmit.
Lets say you want to assign a button click on the form with the new
event. Insert the following code under the button click procedure.
procedure TActiveXtest1.ButtonSubmitClick(Sender: TObject);
begin
If FEvents <> Nil Then
Begin
FEvents.OnSubmit; // OnSubmit is the new event
End;
end;
Compile the application. From the IDE Run menu you can register and
unregister the ActiveX with the registry.
The IDE can create an HTML test document for you to test the ActiveX.
<HTML>
<H1> Delphi 5 ActiveX Test Page </H1><p>
You should see your Delphi 5 forms or controls embedded in the form below.
<HR><center><P>
<OBJECT
classid="clsid:83613669-F82A-4EF6-AADB-F7BD04559711"
codebase="C:/A/Delphi5/Test/ActiveX/Test1/ActiveXtest1Proj1.inf"
id="ActiveXtest1"
width=217
height=89
align=center
hspace=0
vspace=0
</OBJECT>
</HTML>
You can change the code base to use the OCX instead of the INF file:
codebase="C:/NTS/Check/CheckIt.Ocx"
The code base is where the ActiveX is located so if it is not
registered with the registry the Web Browser knows where to find the
OCX.
When loaded from a web-site the code base should point to the URL
where the OCX can be found.
codebase="\activex\checkit.ocx"
You need to read a write the ActiveX property, which can be done with
a VBScript:
<script language="VBScript">
<!-- hide from old browsers
Sub NewAccount(Account)
NtsCheckIt.AccountNo = Account
End Sub
//-->
</script>
Or it can be done with a JavaScript:
<script language="JavaScript">
<!-- hide from old browsers
function new_account_no(account)
{
NtsCheckIt.AccountNo = account;
}
//-->
</script>
So fare so good. Now we get to the best part connecting the event
in the ActiveX OCX and the HTML document.
In the VBScript world you would do the following:
<!--VBScript eg-->
<script language="VBScript">
<!-- hide from old browsers
Sub NtsCheckIt_OnSubmit()
MsgBox NtsCheckIt.AccountNo
End Sub
</script>
The same can also be done in the JavaScript:
<SCRIPT LANGUAGE="JavaScript" EVENT="OnSubmit" FOR="NtsCheckIt">
<!--
alert("Account # " + NtsCheckIt.AccountNo);
// -->
</SCRIPT>
Conclusion:
With the Delphi Active Form you can easily develop ActiveX OCX.
Drop TEdits and TButtons on the form and you have input and output
to the OCX. With the .TLB form you can add Properties and Event
which can be connected to an HTML document via VBScript or JavaScript.