Solved

Thaddy>> wher r u ? ( Java applets question )

Posted on 1998-11-11
19
239 Views
Last Modified: 2009-07-29
Hi there, remember that I posted a question about how to use
java applets in delphi ? You told me to email you for some code, and so I did, but still had no response for almost 2 weeks,

did u ever get my email ?

http://www.experts-exchange.com/topics/comp/lang/delphi/Q.10093140

bryan
0
Comment
Question by:bryan7
  • 10
  • 9
19 Comments
 
LVL 2

Expert Comment

by:Thaddy
Comment Utility
Was on a short break (Dublin) Code on its way
0
 
LVL 3

Author Comment

by:bryan7
Comment Utility
Bublin ? hmm...    

     germany ?

k, I'll be waiting, thanx,

bryan =)

0
 
LVL 2

Expert Comment

by:Thaddy
Comment Utility
email me your adrress please:thaddy@cyco.nl
I knocked up a simple example for you to control Msword from Jscript
0
 
LVL 3

Author Comment

by:bryan7
Comment Utility
hi,

I tried the code, but when it loads it says: ( I have Delphi 3, not 4 )
"Error reading Form1.OldCreateOrder: Property doesn't exist. Ignor..."

then I choose "ignore" and when I run it, I get this error:
"File not found: MSScriptControl_TLB.dcu"

at the USES clause over the MMSCript..

bryan


0
 
LVL 3

Author Comment

by:bryan7
Comment Utility
I think I haven't yet understood what those libs do..

Can I use a Java Applet in my program's form ? I mean, i.e. I have a java applet to make a water reflection effect under an image, ever seen it ?

i.e.: http://geocities.com/SiliconValley/Foothills/2019/lake.htm

bryan
0
 
LVL 2

Expert Comment

by:Thaddy
Comment Utility
All you have to do to get the code working in delphi 4 is:

1) Add the msscript.ocx to the Active X page (Component|Import ActiveX

Download Conert3 from http://www.drbob42.com/
it will convert Delhi4 form files to delphi3 formfiles:-)
the recompile my project

or:
2) Create a form with a standardbutton and a standard memo.
3) Copy the code for the Oncreate handler of the form to your new form
4) Copy the code for the button handler to your form's button handler

The file MsscriptControl_Tlb.pas will be automatically generated in the imports directory.

Now, run the program. If you have EXACTLY what wrote, i guarantee you it will work.

It is alas, almost impossible to write an easier example than this one.

0
 
LVL 2

Expert Comment

by:Thaddy
Comment Utility
Oh, now I see, you don't need scriptsupport, but dhtml support!
You can do this with msscript and you can use applets, provided they are implemented as com classes(See the microsoft documentation on scripting) and that you have an object that supports dhtml, because you write to the html document dynamically. An example is microsofts htmledit ocx.
In principle, you can do what you want, but you need some extra's as I explained.
0
 
LVL 3

Author Comment

by:bryan7
Comment Utility
.. ehh, ..   some extras ? .. I have no idea on how to do it.
can you be a bit more detailed ?

I'll increase the points if you want.( Let's follow this at http://www.experts-exchange.com/topics/comp/lang/delphi/Q.10093140 )

bryan

0
 
LVL 2

Expert Comment

by:Thaddy
Comment Utility
Well, see, the script engine is nothing more than a way to handle language constructs in a universal way. On top of the Script engine goes a parser that creates a prerry much universal stream of byte codes that can be interpreted by the script engine. This parser can be JavaScript, VBScript, Perl, really any language that supports Objects. Mind the last to words: Objects. You can manipulate these objects using the language keywords, let's say javascript. Now, look in your lake.htm code and look in the JavaScript keyword list. You will notice that 'Document' is not a JavaScript Keyword. It's a HTML key word.
That is because Java Script is embedded/connected (depending on the model) into another object or object family, the browser, that has a HTML object. Now,if you want to implement your *.HTM (As opposed to *.JS) into your application, you need apart from the scripting engine one or more objects that support HTML in addition to Javascript. The HTML and additional objects (Java.classes or com objects) can then be manipulated by the scripting language.
Now for your particular wish:
The easiest solution is to import ms internet explorer as an ocx.
Delphi then creates a Component for you called TWebbrowser.
This will automatically support JvaScript.
Pass the Twebbrower simply the url or disk-path to your Lake.Htm and it will work inside your own Application.
The other solution is a bit more complicated and needs conversion of your HTML script (Note:Not JAVA script, the JavaScript is embedded in HTML) and one ore more objects that implement HTML and are capable of Interpreting Javascript.
MsScript is able to interpret JavaScript
MsDhtmlEdit is Able to interpret Html.
So, you need to design an application that uses the JavaScript Scripting engine to manipulate The Html Object (with it's contained object Html.Document).
Clear?

0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 3

Author Comment

by:bryan7
Comment Utility
hmm.. yeah, .. a bit more clear...

there's something you should know: I've been using Delphi from around 2 months ago,
and never before programmed in any windows' language, only Ms-Dos( basic, C, Pascal, assembler,.. ) ., not even in C++ with objects...

Well, I did this: Component/Import ActiveX control, and added msscript.ocx. then I installed 'Microsoft Script Control 1.0'. Then between those ActiveX controls, I saw
'Microsoft internet Controls' with classes: 'TWebBrowser_V1', 'TWebBrowser', and TShellFolderViewOC'.    Is that what I need ?

bryan

0
 
LVL 2

Expert Comment

by:Thaddy
Comment Utility
Yes, that's all!
0
 
LVL 3

Author Comment

by:bryan7
Comment Utility
but there's no help on that TWebBrowser component..

bryan

ps: where could I find some help on the ActiveX controls included with Delphi 3 c/s ?

0
 
LVL 2

Expert Comment

by:Thaddy
Comment Utility
unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  pvOpenDialog, ExtDlgs, OleCtrls, SHDocVw_TLB;
type
  TForm1 = class(TForm)
    br: TWebBrowser;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
var Br2:iwebbrowser2;
begin
  Br2:=br.ControlInterface;
  Olevariant(br2).Navigate2('www.cyco.nl');
end;

end.
0
 
LVL 3

Author Comment

by:bryan7
Comment Utility
..
0
 
LVL 3

Author Comment

by:bryan7
Comment Utility
hi there, your example didn't work, it gave me some probs running.
well, anyway, i found a component that does what i wanted. Not the way i wanted, but nearly.

It's like a box, which can contain a HTML page, as if was a browser.
And it includes the needed help about the procedures.

k, drop something as an answer in both questions, so I can close them.
thanx for all,

bryan

0
 
LVL 2

Accepted Solution

by:
Thaddy earned 0 total points
Comment Utility
It * should have worked *, since I wrote and tested it specially for you. Oh, well, if you need more info, drop me a line.
0
 
LVL 3

Author Comment

by:bryan7
Comment Utility
well, I would like to find some info on the TWebBrowser and the ActiveX Libraries that appear when i choose " Import ActiveX Control ".
There are many components, but there's no help with them..

bryan

ps: give a comment as an answer at the other question, so it can be closed..

0
 
LVL 2

Expert Comment

by:Thaddy
Comment Utility
Have you tried the codecompletion feature? I use that a lot, and it provides me with enough information.
You can find a lot of info on how to use the webbrowser ocx on the msdn. If you do not have direct access to the msdn, it's also on-line on the ms website. The examples are in c++, VB and VBA and can easily be translated into delphi.
Also, when you read the *_TLB.PAS files you can obtain alot of info of how things work. A reasonable understanding of COM is necessary, however. I'd recommend 'Inside COM' and 'Inside OLE'. Both are heavy reading, but those books are the best way to learn to really understand working with this technology.
Also, knowledge of VB and C++ comes in handy, albeit to translate the stuff to delphi.:-)
0
 
LVL 3

Author Comment

by:bryan7
Comment Utility
I'll have a trip throught the ms website, k, thanx for all, I'll try to find about COM and OLE too, I'll post a comment if I ever need some help on this again.

bryan

ps: can we close the other question too ?
http://www.experts-exchange.com/topics/comp/lang/delphi/Q.10093140
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now