Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 264
  • Last Modified:

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

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
bryan7
Asked:
bryan7
  • 10
  • 9
1 Solution
 
ThaddyCommented:
Was on a short break (Dublin) Code on its way
0
 
bryan7Author Commented:
Bublin ? hmm...    

     germany ?

k, I'll be waiting, thanx,

bryan =)

0
 
ThaddyCommented:
email me your adrress please:thaddy@cyco.nl
I knocked up a simple example for you to control Msword from Jscript
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
bryan7Author Commented:
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
 
bryan7Author Commented:
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
 
ThaddyCommented:
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
 
ThaddyCommented:
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
 
bryan7Author Commented:
.. 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
 
ThaddyCommented:
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
 
bryan7Author Commented:
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
 
ThaddyCommented:
Yes, that's all!
0
 
bryan7Author Commented:
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
 
ThaddyCommented:
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
 
bryan7Author Commented:
..
0
 
bryan7Author Commented:
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
 
ThaddyCommented:
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
 
bryan7Author Commented:
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
 
ThaddyCommented:
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
 
bryan7Author Commented:
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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 10
  • 9
Tackle projects and never again get stuck behind a technical roadblock.
Join Now