Jump to content

Recommended Posts

  • 2 months later...
  • 3 months later...
Posted

hi ,  Anybody can help me solve  this problem?

 

thank for your kindness.

 

You want to know the server time on the client side?

 

There are several ways, one of them:

 

1. Declare a variable.

     In MainForm.Scripts add the line: 

var uniGUIServerTime;

2. Now you can assign it a value:    

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  UniSession.AddJS('uniGUIServerTime = "' + DateTimeToStr(Now) + '";');
end;

3. Now on the client side you can use this variable

 

Best regards.

Posted

You want to know the server time on the client side?

 

   yes, that right.

 

There are several ways, one of them:

 

 

Thank you very much.

Posted

hi, delphi developer

 

Thank you very much for your answer.

 

i have some problem.

 

step 1.  In MainForm.Scripts add the line: 

                var uniGUIServerTime;

                  

                    ok

 

step 2.

procedure TMainForm.UniFormCreate(Sender: TObject);

begin
  UniSession.AddJS('uniGUIServerTime = "' + DateTimeToStr(Now) + '";');
end;

 

                     ok

 

step 3.   use  unit   uniGUIApplication;

 

step 4 .  i make event  onbuttonclick;

 

procedure TMainForm.UniBitBtn1Click(Sender: TObject);

begin
  UniLabel1.Caption :=  UniSession.uniGUIServerTime;
end;

 

  error message  [dcc32 Error] Main.pas(40): E2003 Undeclared identifier: 'uniGUIServerTime'

 

Thank you very much for your help.

Posted

Hi vitisan.
 

var uniGUIServerTime; - It is not delphi variable, it is a variable javascript!

You must use this:

1. 

procedure TMainForm.UniBitBtn1Click(Sender: TObject);
begin
  UniLabel1.Caption :=  DateTimeToStr(Now);
end;

or
 
2.
procedure TMainForm.UniBitBtn1Click(Sender: TObject);
begin
  UniSession.AddJS(UniLabel1.JSName + '.setText(uniGUIServerTime)');
end;

or

 
3.
procedure TMainForm.UniBitBtn1Click(Sender: TObject);
begin
  UniSession.AddJS(UniLabel1.JSName + '.setText(' + DateTimeToStr(Now) + ')');
end;

Best regards.

Posted

You want to know the server time on the client side?

 

There are several ways, one of them:

 

1. Declare a variable.

     In MainForm.Scripts add the line: 

var uniGUIServerTime;

2. Now you can assign it a value:    

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  UniSession.AddJS('uniGUIServerTime = "' + DateTimeToStr(Now) + '";');
end;

3. Now on the client side you can use this variable

 

Best regards.

 

 

 

I have difficulty understanding the issue here.

 

The answer to original question seems to be as easy as:

UniLabel1.Caption := DateTimeToStr(Now);

 

I thought that the question was about the variable on the client side ...

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...