Home Forum Download/Upload Links Search

NetTalk User Group

NetTalk User Group Meeting!
Live Webinar!
Saturday Nov. 16 
7am PST
Click Here To Register!
NetTalk Central
June 28, 2017, 07:36:22 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Welcome to the NetTalk Central Forums!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Timer in a Memory Form  (Read 168 times)
michelis
Hero Member
*****
Posts: 1118


alberto-michelis@hotmail.com
View Profile WWW Email
« on: June 12, 2017, 01:03:53 PM »

Hi Im using a calendar js in a Form and I need it to be refresh with a timer.
How can I do it?
Or better... every time another user modifies it
Any way?
Thanks
Logged

-----------
Regards
Alberto
Bruce
Global Moderator
Hero Member
*****
Posts: 8600



View Profile
« Reply #1 on: June 12, 2017, 11:37:43 PM »

>> Or better... every time another user modifies it

That's what WebSockets are for. Much better than a timer.
see
http://www.capesoft.com/accessories/NetTalkUserGroup.htm
search for Web Sockets.

cheers
Bruce
Logged
michelis
Hero Member
*****
Posts: 1118


alberto-michelis@hotmail.com
View Profile WWW Email
« Reply #2 on: June 13, 2017, 06:36:36 PM »

Bruce, I search, view and try to understand the talkings about Web Sockets.
Then I open the WebSockets example.
My questions are:

- Are you suggesting me to add a Display field (HostValue) to tell the memory form that another user had modify the calendar? using the technic of the example?
And Can I refresh the calendar js when the host variable field in the form changes? may be adding code to the server side of this field?

-Then how do I set the server Host Variable value from a p_web object (the memory form which contains the calendar)? I cant use a session value because it will be only for the session user and may be thers many users modifiing the same calendar so, I think I need a Host variable. HOw to change it from the p_web memory form?

-Another problem is that there are Groups of users that modify the same calendar, let say you have 10 users connected, 3 are modiying cal1 , 3 mod cal2 and 4 mod cal 3, diference between calendars are only the filter of the events of each one cal.
Then may be I need many host variables, one for each group.
And... I need to set the name of this host variables at run time, because I dont know now whos connected or which filter the user will apply.
In other words I need a variable for each possible calendar filter applyed and, users that are applying the same filter, must receive the same host variable change.

As you can see... I need some more guidance, please

Thanks
« Last Edit: June 13, 2017, 07:18:23 PM by michelis » Logged

-----------
Regards
Alberto
Bruce
Global Moderator
Hero Member
*****
Posts: 8600



View Profile
« Reply #3 on: June 14, 2017, 05:30:25 AM »

Hi Alberto,

>> Are you suggesting me to add a Display field (HostValue) to tell the memory form that another user had modify the calendar?

that's one approach.
But I suspect you will need to make a JavaScript function which "watches" a host value, and then when a new host value arrives tells the calendar to do something.

look in nt-websockets.js
I haven't tried it but you'll basically do something similar to what the ntSockets.prototype.watch function does, but with a custom on message function.

I haven't tried it, but something like this;

function AlbertoWatchCalendar(url,scope,id,varname){
   if (varname == undefined){
      varname = id;
   }
   nts.open(url,
      function(i){ // on open
         _nts.sendText(i,'watch ' + scope + ' ' + varname);   
      },
      function(event,json,i){ // on message
         if (json[varname] !== undefined){
            //console.log('incoming data id=' + id + ' varname=' + varname + ' value=' + json[varname]);
                               // your javascript code to tell the calendar to refetch the data goes here.
         }      
      }   
   )
}


>> Then how do I set the server Host Variable value from a p_web object (the memory form which contains the calendar)?

p_web.SetHostValue('somename','somevalue')

>> Then may be I need many host variables, one for each group.

sure, you can make as many as you need.

cheers
Bruce




Logged
michelis
Hero Member
*****
Posts: 1118


alberto-michelis@hotmail.com
View Profile WWW Email
« Reply #4 on: June 14, 2017, 05:51:18 AM »

Thanks but sory Im Learning js and Im not so good enought

Ive deleted the // from //console.log...... of the example, just to see what happens but nothing happens. Does it have to work? will help to see what Iam doing.

Looking at the Form Web Source of the example I see:

nts.watch("","hostvalue","#NumberOfUsers","usersonline");

and searching on how the nt clarion source does this line I found:

p_web.ntWatch('hostvalue', '#' & p_web.nocolon('FormControlUsersOnline') , 'UsersOnline')

and .ntWatch finally does a:

p_web.script('nts.Watch("","hostvalue","#' & p_web.nocolon('FormControlUsersOnline')&'","UsersOnline");')

which lead us to the resulting nts.watch("","hostvalue","#NumberOfUsers","usersonline");

Now,
1-how do I add that new function without editing the nt-websockets.js? can I add it as any script?

2-how do I call my (yours) new watch js proc from Clarion code and Where?
I suppouse using p_web.script(....) but how and where?


Thanks


« Last Edit: June 14, 2017, 11:23:36 AM by michelis » Logged

-----------
Regards
Alberto
Bruce
Global Moderator
Hero Member
*****
Posts: 8600



View Profile
« Reply #5 on: June 20, 2017, 01:34:29 AM »

Perhaps we should discuss this at the webinar on Thursday Alberto.

Cheers
Bruce
Logged
michelis
Hero Member
*****
Posts: 1118


alberto-michelis@hotmail.com
View Profile WWW Email
« Reply #6 on: June 21, 2017, 05:14:09 AM »

I cant because of the time...
If you cant show how to do it to the others I can see the video later
Please, I think is something realli usefull for others too.
Regrads
Logged

-----------
Regards
Alberto
michelis
Hero Member
*****
Posts: 1118


alberto-michelis@hotmail.com
View Profile WWW Email
« Reply #7 on: June 23, 2017, 03:15:46 AM »

Hi Bruce, could you see it in the webinar?
Logged

-----------
Regards
Alberto
Bruce
Global Moderator
Hero Member
*****
Posts: 8600



View Profile
« Reply #8 on: June 23, 2017, 08:22:09 AM »

Unfortunately no - perhaps you can join us next Thursday/

cheers
Bruce
Logged
michelis
Hero Member
*****
Posts: 1118


alberto-michelis@hotmail.com
View Profile WWW Email
« Reply #9 on: June 27, 2017, 02:42:38 AM »

I cant Bruce, please... I am working at this time.
Logged

-----------
Regards
Alberto
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!

Login Form

Welcome Guest.






Lost Password?
No account yet? Register
home contact search contact search