Page 2 of 2

Re: screen properties

Posted: Mon Jul 02, 2018 5:53 am
by asier
Sorry like this:
"add enhancements": {
"window flag": true,
"format":{
"screen": {
"overlay":"",
"show as window":"true",
"assume":"true",
},
}
},

Re: screen properties

Posted: Tue Jul 03, 2018 11:50 am
by Scott Klement
Asier,

Add enhancements is a function, but you've coded it as an object. I'll see if I can dig up (or maybe write) a quick example.

Re: screen properties

Posted: Tue Jul 03, 2018 12:23 pm
by Scott Klement
The idea behind "add enhancements" is that it is run after everything has already been created. It then gives you a last chance to add any additional enhancements via JavaScript to your screen by running this "add enhancements" script. It passes you parameters with information about the screen that it has created -- most of these parameters are for your function to read and use as information. The "window flag" and "subfile flag", for example, are sent to tell your function whether the screen is (or isn't) a window or subfile. You cannot change these, as the values aren't sent back to the DDS converter.

The exception to this is the "format" parameter. This contains everything the DDS converter has created about the properties on the screen, and here you can make changes if you like.

In your example, you are, I suppose, trying to set all record formats to be windows? That would be a really bad idea, in my opinion. Remember, the screen has already been created at this point, so if the format you're converting from was full-screen, and you made the one you're converting into be a window, it'd be a window that took up the entire screen. So, it wouldn't look like a window! But, since you're treating it as a window, it'd overlay everything that's already on the screen. All previous screens would be drawn, but this full-screen window would be drawn on top of it, hiding the others. Over time, this could result in hundreds or even thousands of formats being drawn every time the user displays a screen, with most of them not visible. This would be horrendous for performance, and serve no value. So, I assume this was a mistake?

Perhaps you simply wanted to set these properties only when converting window formats? If so, you'd CHECK (not set) the "window flag" to determine if it's a window, and then set the format/screen properties appropriately, like this:

Code: Select all

  .
  . 
  "add enhancements": function(format, isSfl, isWindow, member, formatDDS) {
     if (!isSfl) {
       if (isWindow) {
         format.screen["overlay"] = "";
         format.screen["assume"] = "true";
       }
     }
  },
  .
  .
In this example, I'm blanking out the "overlay" property, and setting the "assume" property on all window formats. (I'm also making sure it's not a subfile, but that is probably not necessary, since subfiles aren't ever windows.)

If you wanted to set another property, for example, maybe you want to set the screen description for all non-window formats? You'd do something like this:

Code: Select all

  .
  .
  "add enhancements": function(format, isSfl, isWindow, member, formatDDS) {
     if (!isSfl) {
       if (isWindow) {
         format.screen["overlay"] = "";
         format.screen["assume"] = "true";
       }
       else {
         format.screen["description"] = "Created by Asier's Theme";
       }
     }
  },
  .
  .
Hope that helps

Re: screen properties

Posted: Wed Jul 04, 2018 2:29 am
by asier
Thanks a lot! this works