INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Integrating custom ActiveX control into HTML document with Javascript

Integrating custom ActiveX control into HTML document with Javascript

Integrating custom ActiveX control into HTML document with Javascript

(OP)
I started playing with windows desktop gadgets, which are essentially mini web pages. I'm building an ActiveX control using Delphi and importing this control into the HTML doc. Now I'm not too familiar with HTML/javascript, but very familiar with Delphi. I need to be able to interact with this ActiveX component from Javascript, and be able to trigger events in the component to execute event handlers in the javascript.

I have it declared like this:

CODE

<head>
  <script type="text/jscript" language="jscript">
    function init()
    {
      var oBackground = document.getElementById("imgBackground");
      oBackground.src = "url(GadgetBackSmall.png)";
      //Somehow set my component's event "OnMyNumberChanged" to function "MyNumberChanged"
      //id of component is "JDNG"
    }
    function MyNumberChanged(Sender, Value)
    {
      //In Delphi...
      //> Sender: TObject;
      //> Value: Integer;
      //Somehow write for example Width of component, or other properties
    }
  </script>
</head>
<body onload="init()">
  <g:background id="imgBackground">
    <object classid="clsid:E09288CA-7458-4CD8-AD50-2B8AE8D06019" id="JDNG"
      style="position:relative;float:left;
      width:100%;height:100%;left:10px;top:10px;border:none;">
    </object>
  </g:background>
</body>

for example, if I have my own property in this component called "MyNumber" then how would I read/write MyNumber from javascript?

I assume in the onload() event handler I will have to assign some event handler to an appropriate event, such as "OnMyNumberChanged". Or do I set this in the declaration of <object />?

JD Solutions

RE: Integrating custom ActiveX control into HTML document with Javascript

Hi JD Solutions,

Here's a tip - Javascript functions can have parameters, and I personally thimk "document.getElementById" is lazy programming.

function init(object JDNG) { //call JDNG.OnMyNumberChanged }

So why does the <object> declaration have to be in <body> ?

I'm not an expert but there should be a more coherent approach,

Yours, Jim.

RE: Integrating custom ActiveX control into HTML document with Javascript

Maybe you should ask in the Javascript forum

Cheers,
Dian

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close