screen properties

Use this board for starting discussions, asking questions, and giving advice on Web programming for the IBM i platform (and predecessors.)
asier
New User
Posts: 12
Joined: Tue Jun 26, 2018 3:40 am
First Name: Asier
Last Name: E
Company Name: E
Contact:

Re: screen properties

Post by asier »

Sorry like this:
"add enhancements": {
"window flag": true,
"format":{
"screen": {
"overlay":"",
"show as window":"true",
"assume":"true",
},
}
},
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: screen properties

Post 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.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: screen properties

Post 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
asier
New User
Posts: 12
Joined: Tue Jun 26, 2018 3:40 am
First Name: Asier
Last Name: E
Company Name: E
Contact:

Re: screen properties

Post by asier »

Thanks a lot! this works
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests