Page 1 of 1

Detecting Rich Display

Posted: Tue Apr 04, 2017 11:04 am
by pjshuey
Is there an easy way to detect in genie when the program being called is a rich display without modifying the program? Maybe something that can be added to the custom.js for the genie skin???? I want to position the div's differently if it is a rich display.

Re: Detecting Rich Display

Posted: Wed Apr 05, 2017 5:46 pm
by Scott Klement
Would pui.getDisplayType() work for you? Here's the docs:
http://www.profoundlogic.com/docs/pages ... d=25854266

Re: Detecting Rich Display

Posted: Thu Apr 06, 2017 8:30 am
by pjshuey
Yes! That should do it! I search and searched for a command and did not see that one. Sorry for wasting your time!

Re: Detecting Rich Display

Posted: Thu Apr 06, 2017 12:09 pm
by pjshuey
Is there any way to prevent the genie.js from setting the position of the insideDiv to "relative" if the display type is 'rdf'?

Re: Detecting Rich Display

Posted: Thu Apr 06, 2017 4:08 pm
by Scott Klement
Not that I'm aware of -- I believe it always sets the div with id="5250" to relative positioning.

You could set it to a different positioning style yourself if you wanted with code like this:

Code: Select all

pui.runtimeContainer.style.position = "absolute";
It's hard (for me, anyway) to visualize everything that might affect, but you could try it and see.

Re: Detecting Rich Display

Posted: Fri Apr 07, 2017 9:19 am
by pjshuey
I did do that but control goes back to genie.js before the screen is actually rendered and it sets it back to relative.

Re: Detecting Rich Display

Posted: Fri Apr 07, 2017 11:11 am
by matt.denninghoff
In the genie rendering code, setting the runtimeContainer's style.position to "relative" is one of the last things that happens--after all "onload" and other customize-able events.

If there is no other way to accomplish what you're trying to do, it is possible to use the JavaScript setTimeout function to make your code run after the rendering code's call stack finishes.

For example:

Code: Select all

// Queues this function in the JavaScript "message" queue.
  setTimeout(function(){
    console.log("timeout, set style position.");
    pui.runtimeContainer.style.position = "absolute";
  },0);
However, when using setTimeout, sometimes timing of code can get complicated and difficult to debug. You might have more luck doing something like this in a pui.onload function defined inside your Genie skin's custom.js file:

Code: Select all

  pui.genie.setContainerWidth = false;
  pui.runtimeContainer.style.width = "100%";

Re: Detecting Rich Display

Posted: Fri Apr 07, 2017 1:35 pm
by pjshuey
Thank you! I had to go with the first option, but it works beautifully!