You can actually create a timer in a softone object!

554 views
Skip to first unread message

Νίκος Μάλιακκας

unread,
Feb 14, 2023, 10:44:54 AM2/14/23
to Softone Developers Network
Hello to all.
I was trying to create an event for, when the user is scrolling in a datagrid and changing lines (moves up and down a datagrid), and finally achieved it:

In the objects header table, I added a new integer field.
I added a special / user panel component in the view with editor: HTML
and code:

<html>
<body>
<script>
var XCon=external;
var counter=0;
setInterval(checkCurrentLine,1000);
function checkCurrentLine(){
var command={data:{CCCRPSTEVALOPTIONS:[{INTCOUNTER:++counter}]}};
XCon.setData(this, JSON.stringify(command),function(scope, resp){});
}
</script>
</body>
</html>



Now the field CCCRPSTEVALOPTIONS.INTCOUNTER
updates every second, so at the
ON_CCCRPSTEVALOPTIONS_INTCOUNTER
function I can make the checks I need and raise my custom event if appropriate

For the time it only works with internet explorer 11 and not with the webview2 option,
but does not take up resources or slows the app.

I used it in a dialog object in S1 Designer, if you want to use it in other views, I think you will have to use the HTMLCODE editor instead of HTML

Νίκος Μάλιακκας

unread,
Feb 14, 2023, 11:06:40 AM2/14/23
to Softone Developers Network
Ok, now it play's and by using /usewebview2 option:
replace this with {} in setData first argument:
XCon.setData({}, JSON.stringify(command),function(scope, resp){});

with Edge webview2 you can press F12 inside the browser panel and open dev tools.
There I saw some error messages about a circular referance to the window object.

so when I replaced "this" with an empty object "{}" as above, it worked too!

Αντώνης Μ.

unread,
Feb 15, 2023, 3:33:29 AM2/15/23
to Softone Developers Network
That's impressive! Always looking forward to unique stuff like that! 

Niculescu Ionut

unread,
Feb 16, 2023, 2:35:47 AM2/16/23
to Softone Developers Network
Hello!
Thank you for sharing this! It's really useful!
Reply all
Reply to author
Forward
0 new messages