cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

How to get client screen resolution

Chanin
13-Aquamarine

How to get client screen resolution

hello,
I want to get the screen size, how do I do it on ThingWorx 9.3.2
what I have tried :

//This will return a string for the resolution
Output = screen.width + "x" + screen.height

Detect Resolution of Monitor viewing a ThingWorx Mashup 

and

 

console.log("Width: " + screen.width);
console.log("Height: " + screen.height);

 

Get Client Screen Resolution 

 

still can't get resolution please suggest thanks you.

6 REPLIES 6
jensc
17-Peridot
(To:Chanin)

Hello,

 

Seems like it is not supported in 9.3 as per the support ticket;

jensc_0-1679315695360.png

There doesn't seem to be any documentation in the PTC Help Center that this has been deprecated though.

I did try some of the "TW" functions to see if I could find something similar, but wasn't able to. I thought that perhaps "TW.Runtime.Workspace.Mashups.Current.UI" would have the screen size in its return.

 

Perhaps someone else has a good workaround for this.

 

Regards,

Jens

 

Chanin
13-Aquamarine
(To:jensc)

I have tried TW.Runtime.Workspace.Mashups.Current.UI


result is undefined

Chanin_1-1679379219593.png

Hello,

 

In 9.3 this won't be possible without implementing a custom extension. Usually, it's possible to work around the need for getting the screen resolution. What is your scenario, why do you need it?

 

/ Constantine

Chanin
13-Aquamarine
(To:Constantine)

Hello @Constantine ,

I want to set CellWidthField of the collection widget by screen resolution.

 

Scenario is

  • get client screen resolution (1920,1366) and send to service
  • service output with data and width
  • CellWidthField select width from output service

Chanin_0-1679540554189.png

And i tried using CSS to set MashupWidth but still can't set width.

 

Thank you for your help

GabrielB
12-Amethyst
(To:Chanin)

If you want the collection cell to be the whole width of the container, not matter the width, set these settings like this:

View: Flow,

MashupWidth: 9999

FlowLayoutGravity: Expand

 

The Expand on the MashupWidth will act as a minimum width OR if it's something huge like 9999 it will span the whole width of the container.

 

Hope it helpes,

Gabriel - IQNOX

jensc
17-Peridot
(To:Chanin)

Hello,

 

Just wanted to post an update here as I just realized I missed the most obvious thing in the PTC help center link from my previous post which clearly states that the following should be supported.

 

jensc_0-1680703048866.png

 

But I can at least not get the "TW.screen.width/TW.screen.height" to work.

Perhaps it would be good to open a support ticket for this.

 

Regards,

Jens

 

Announcements


Top Tags