Difference: 0LASubrWidgetApplyTheme (8 vs. 9)

Revision 92012-05-30 - JeanNeron

Line: 1 to 1
 
META TOPICPARENT name="APPXRuntimeSubroutineAPI"

.WIDGET APPLY THEME

Line: 15 to 15
  This subroutine applies a GUI Theme to the the current image. No parameters are required, however, some setup is needed.
Changed:
<
<
Before you can use this subroutine, you must create at least one MENU process to act as a 'theme'. On the image of the menu process, add various Widgets for the elements you want to standardize. For example, if you want all your buttons to have certain foreground/background/rollover colors, then define a button with the desired attributes. The same thing applies to Titlebar attributes, background images, items (fields), and so on. If you have standard attributes you want applied to some buttons, but not others, then define another button and give it a name. For example, you might want to have your 'Cancel' buttons look different from other buttons. You could give it the name CANCEL BUTTON. On the images in your application where you want a button to use those attributes, give it the same name. This technique applies to all Widget types. If the subroutine cannot find a match in your theme for a particular name, it will default to the unnamed widget in your theme. In other words, if your theme did not contain a button called CANCEL BUTTON it would use the unnamed button, if there was one.
>
>
Before you can use this subroutine, you must create at least one MENU process to act as a 'theme'. On the image of the menu process, add various Widgets for the elements you want to standardize. For example, if you want all your buttons to have certain foreground/background/rollover colors, then define a button with the desired attributes. The same applies to Titlebar attributes, background images, items (fields), and so on. If you have standard attributes you want applied to some buttons, but not others, then define another button and give it a name. For example, you might want to have your 'Cancel' buttons look different from other buttons. You could give it the name CANCEL BUTTON. On the images in your application where you want a button to use those attributes, give it the same name. This technique applies to all Widget types. If the subroutine cannot find a match in your theme for a particular name, it will default to the unnamed widget in your theme. In other words, if your theme did not contain a button called CANCEL BUTTON it would use the unnamed button, if there was one.
  You can also use 'prefixes' in Widget names. If the Widget name in your theme ends with a period, then this routine will apply the theme to every other widget that begins with that name. For example, if you create a button with a widget name of "NAV.", then the theme will be applied to every button whose name begins with "NAV.", such as "NAV.OK", "NAV.CANCEL", "NAV.NEXT REC" or just "NAV.".
Line: 23 to 23
  Next, you want to set that name somewhere in your application by calling .WIDGET SET THEME. This sets a Detached work field, so you only need to assign it once. You can change this whenever you want. For example, different applications can use different themes just by changing this name. If your Theme Menu is not in the current application, then you should also set the APPLICATION paramenter of .WIDGET SET THEME to the application id that contains the Theme Menu. If this is blank, the subroutine will look in the current application. You can also use a theme that is in a different version by setting the VERSION parameter of .WIDGET SET THEME.
Changed:
<
<
Finally, you should add a GOSUB to this subroutine in the Global Pre-Display event point of your Inputs and Menus. You can use the .WIDGET MISSING THEME subroutine to help you find these processes.
>
>
Finally, you should add a GOSUB to this subroutine in the Global Pre-Display event point of Inputs and Pre-Display event point of Menus. You can use the .WIDGET MISSING THEME subroutine to help you find these processes.
  You can create more than one theme for use in different processes. This is done by first creating another Menu Theme process with the same base name as your main Theme Menu, and then appending a period and some additional characters. For example, you may want all your File Maintenance processes to have a different look from Data Entry processes. You could define 2 additional theme menu processes, one with ".FM" appended to the name, and one with ".DE" appended to the name. In the Input processes where you want to use the ".FM" theme, go to the Image Editor, Window Properties, and put ".FM" as the widget name. Do the same for the Data Entry processes. At runtime, the --- .WIDGET APPLY THEME subroutine will notice the widget name, append it to the base name set with .WIDGET SET THEME, and use that process as the theme. You could also simply change the theme to point to another theme, but since it is Detached, it will retain that new theme until you change it back.
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback