GMSC Discussions

GeoMedia Smart Client community discussion board is where you can create, contribute and share information and knowledge in regards to configuring as well as working with GeoMedia Smart Client. Find your answers, share your knowledge and help build a strong GeoMedia Smart Client community.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Contributor
Posts: 25
Registered: ‎06-17-2019
Accepted Solution

Keep JavaScript execution alive after form has been closed - V16.5 vs. V16.1

Hi all,

 

I have a javascript-code which is executed in an own workflow window on application startup (IG.vent.on('smartclient:ready', ...).

It should repeatedly check every 3 sec for some UI changes and when conidition is met it should update an infobox.

Even when the workflow window is closed (via IG.closeWebBrowser())

 

This worked fine in GMSC Client V16.1 but with V16.5 the javascript execution stops when the workflow window has been closed (via IG.closeWebBrowser()).

 

Does anyone know if the GSCM workflow logic has been changed in V16.5 (maybe some kind of garbage collection?)?

Is there a way to overcome this?

 

For now as a workaround the IG.closeWebBrowser()-command is disabled when using client V16.5, but it would be difficult to also alsk the end users to not manually close that window.

 

Thanks for any help,

Bernhard

Staff
Posts: 1,051
Registered: ‎10-18-2015

Re: Keep JavaScript execution alive after form has been closed - V16.5 vs. V16.1

hi Bernhard,

 

it really surprises me it was working closing the window, the JS should be defined only within the browser context. How did you manaage to show the notification with the window closed? Wouldn't be enough to use bringToFront and bringToBack methods?

 

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Contributor
Posts: 25
Registered: ‎06-17-2019

Re: Keep JavaScript execution alive after form has been closed - V16.5 vs. V16.1

Hi Stefano,

 

thanks for your quick reply.

I've tried to use the SmartClient.bringToBack() method but it only sends the main form to the back - the start window (with the script) is still visible - also in the taskbar.

Please see the following screenshot:

 screenshot.jpg

 

I would like to hide this window (if that is the only way to keep the javascript running in the background).

 

To be honest I am also wondering why this worked in the previous version.

I am trying to debug the code from a colleague - I am pretty new to the whole GMSC world :-)

 

Br

Bernhard

Staff
Posts: 1,051
Registered: ‎10-18-2015

Re: Keep JavaScript execution alive after form has been closed - V16.5 vs. V16.1

I'm not quite sure I understand your configuration: do you have more than one window opened? You may try to explore the usage of tabs instead and make the tab hidden using the API.

 

Stefano 

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Contributor
Posts: 25
Registered: ‎06-17-2019

Re: Keep JavaScript execution alive after form has been closed - V16.5 vs. V16.1

[ Edited ]

It is a startup workflow (workflow starts when application is started).

I think a logic based on tabs is not possible here because we have only one workflow form which informs the user about the initialization (and which should do some additional tasks in the background not visible to the user) and should close itself after the init - but keep some maintenance tasks still running. (in the previous verison it was possible that the workflow is sitll doing stuff even when the workflow was visually closed - in the current version we do not close the workflow form anymore).

 

Even if that way is not possible anymore, is there a maybe an easier solution to execute code within a main thread which does not rely on any user interfaces (and therefore cannot be unintentionally stopped by the end user)?

 

Thx

Bernhard

Staff
Posts: 1,051
Registered: ‎10-18-2015

Re: Keep JavaScript execution alive after form has been closed - V16.5 vs. V16.1

the best way is a custom Java plugin, but I would wait for the new 2019 release if you have the chance to do it, since it will come with a new Java API.

 

As workaround you may set the workflow to be opened in the left panel. If you don't provide a specific "close" button there is no way to close it and the user can switch back to the legend or bookmarks panels. 

 

I'm sorry you are breaking your existing use case implementation, but as i said it's really a surprise it was working in such a way.

 

thanks,

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Frequent Contributor
Posts: 119
Registered: ‎04-05-2016

Re: Keep JavaScript execution alive after form has been closed - V16.5 vs. V16.1

Hi Stefano,

 

is the any information yet on what the changes to the Java API will mean for existing and future GMSC Java extensions?

 

Regards,

Sven

Contributor
Posts: 25
Registered: ‎06-17-2019

Re: Keep JavaScript execution alive after form has been closed - V16.5 vs. V16.1

Hi Stefano,

 

thanks for your response! (and sorry for my delayed answer, I was on holiday the last 5 days)

 

Interesting, your hint with the workflow in the left panel.

Do you know if it is possible to set there also maybe the size (width + length) to 0 px - so that the workflow window would be invisible?

 

The reason why this JavaScript logic was implemented this way was that they tried to "listen" on user click events on the left side in the panel/legend and if something was ticked/unticked to update an info box on the right side with a short description of what's now displayed.

Maybe there is now an easier way to listen on such events or even create triggers which do the same stuff event based?

 

Regards,

Bernhard

Staff
Posts: 1,051
Registered: ‎10-18-2015

Re: Keep JavaScript execution alive after form has been closed - V16.5 vs. V16.1

hi Bernhard,

 

can you please clarify what "...in the panel/legend and if something was ticked/unticked" means? You may open the workflow in the datagrid instead of the left panel, if you need to keep the left panel focused, but you cannot really hide the workflow window. 

 

BTW, the best approach would be a custom JAVA plugin in my opinion.

 

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Contributor
Posts: 25
Registered: ‎06-17-2019

Re: Keep JavaScript execution alive after form has been closed - V16.5 vs. V16.1

Hi Stefano,

 

thanks again for your ongoing support!

 

Please see the image below which hopefully explains better what I mean:

 

Screenshot_Legende.jpg

 

 

I will keep the Java Plugin in mind, thx!

 

 

Regards

Bernhard