Jump to content

Due with Java script


thecrgrt

Recommended Posts

Can you give a specific example?

Get some values from or set some values to JS controls, create an event for some JS controls in JavaScript using Delphi code.

 

By the way, I found the interest property, JSName that I can create dynamic JavaScript to receive an information from Delphi code, but where is JSCode method of WebForm? why it disappeared from 0.85.0?

Link to comment
Share on other sites

  • Administrators

Get some values from or set some values to JS controls, create an event for some JS controls in JavaScript using Delphi code.

 

By the way, I found the interest property, JSName that I can create dynamic JavaScript to receive an information from Delphi code, but where is JSCode method of WebForm? why it disappeared from 0.85.0?

 

JSCode is a protected method: Use a hack to access it:

type
 TUniControlHack = class(TUniControl);

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
 if WebMode then
   TUniControlHack(WebForm).JSCode('alert("blalalala");');
end;

Link to comment
Share on other sites

JSCode is a protected method: Use a hack to access it:

type
 TUniControlHack = class(TUniControl);

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
 if WebMode then
   TUniControlHack(WebForm).JSCode('alert("blalalala");');
end;

Thank you, I'll try its.

Link to comment
Share on other sites

Hi, Farshad...

 

How can I execute this code?

 

if WebMode then

TUniControlHack(WebForm).JSCode(

'<link rel="stylesheet" href="dhtmlwindow.css" type="text/css" />'+

'<script type="text/javascript" src="dhtmlwindow.js">'+

'dhtmlmodal.open("EmailBox", "iframe", "modalfiles/newsletter.htm", "Newsletter Signup page", "width=350px,height=200px,center=1,resize=0,scrolling=1");');

 

Method dhtmlmodal is inside a .js called "dhtmlwindow.js". I put this file in same application path, but script doesn't works. Can you help me?

 

Thanks

Link to comment
Share on other sites

  • Administrators

Hi, Farshad...

 

How can I execute this code?

 

if WebMode then

TUniControlHack(WebForm).JSCode(

''+

'<script type="text/javascript" src="dhtmlwindow.js">'+

'dhtmlmodal.open("EmailBox", "iframe", "modalfiles/newsletter.htm", "Newsletter Signup page", "width=350px,height=200px,center=1,resize=0,scrolling=1");');

 

Method dhtmlmodal is inside a .js called "dhtmlwindow.js". I put this file in same application path, but script doesn't works. Can you help me?

 

Thanks

 

You can't put html inside JSCode().

 

Put "dhtmlwindow.js" inside ServerModule.CustomFiles

Then put your html/js code inside a uniHTMLFrame

Link to comment
Share on other sites

a very interesting code. There is something like this to do the opposite? Delphi receive a value from javascript.

Whether JSCall and JSCallCatch methods can do this, IMO.

But I don't know how to use them, maybe we wait for Farshad answer.

Link to comment
Share on other sites

  • Administrators

Hi all,

 

We will try to support client side scripting as much as we can,but we shouldn't forget that there are almost infinite possibilities when you combine JS/HTML/CSS and similar technologies.

 

In order to exchange values between Delphi and JS we need to construct the proper infrastructure which will handle all these tasks in a reliable and automatic way. Currently you can achieve this, but for this you need to use some dirty hacks which may work only for a particular problem.

 

After version 0.90.0 or maybe earlier we will start to focus on client side scripting and event handling. Until then I will try to answer simple cases regarding scripting, but for more complex cases, especially those which need implementing a two way communication between server and client, I may not be able to solve your issue.

 

Thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...