support: Customer Portal
Focused on delivering choice, investment protection and flexibility to organizations with valuable COBOL assets

Veryant Knowledge Base
Home > All Categories > isCOBOL General > User Interface > Modernizing your COBOL application by using isCOBOL Compiler code injection
Question Title Modernizing your COBOL application by using isCOBOL Compiler code injection

In version 2019 R1 we introduced new compiler configuration variable to inject COBOL code in all controls of a specific type at compile time.

where can be any of the following: bar, bitmap, check_box, combo_box, date_entry, entry_field, frame, grid, java_bean, label, list_box, push_button, radio_button, ribbon, scroll_bar, slider, status_bar, tab_control, tree_view, web_browser, window, tool_bar.
This feature simplifies the modernization process for GUI applications and reduces developing efforts.

As an example, when compiling the following screen section controls:
    01  s1.
        03 ef1 entry-field 
           line 2 col  2 size 10.
        03 ef2 entry-field 
           line 2 col 14 size 10.
        03 ef3 entry-field 
           line 2 col 26 size 10.
        03 pb1 push-button 
           line 5 col 10 size 10 
           title "Save" exception-value 1.
with the following compiler configuration:
iscobol.compiler.gui.push_button.defaults=flat, background-color -14675438
iscobol.compiler.gui.entry_field.defaults=border-color rgb x#dae1e5, \
                                          border-width (0 0 2 0 )
the compiler will treat the source code as if it were written as:

    01  s1.
        03 ef1 entry-field 
           border-color rgb x#dae1e5, 
           border-width (0 0 2 0)
           line 2 col  2 size 10.
        03 ef2 entry-field 
           border-color rgb x#dae1e5, 
           border-width (0 0 2 0)
           line 2 col  2 size 10.
        03 ef3 entry-field 
           border-color rgb x#dae1e5, 
           border-width (0 0 2 0)
           line 2 col  2 size 10.
        03 pb1 push-button 
           flat, background-color -14675438
           line 5 col 10 size 10 
           title "Save" exception-value 1.
Code injection also affects controls created with single display statement, so that:
    display push-button 
            line 5 col 25 size 10
            title  "End" exception-value 27 
            handle in h-pb.
    display push-button flat, background-color -14675438
            line 5 col 25 size 10
            title  "End" exception-value 27 
            handle in h-pb.
With code injection, an entire application can be recompiled without code changes.
Changing the configuration variables can result in a completely different looking application, letting you modernize your screens without altering the source code.

NOTE: Code injection works by inserting the text value of the configuration variables into the source code where controls are declared or created.
That means any syntax errors in the configuration variables will result in compilation errors.

As an example, the following screen is a standard screen with slightly dated looking controls and window:

By compiling with the following compiler configuration:

   # Compiler.regexp to remove the 3D and "ERASE" styles when displaying the window
   iscobol.compiler.regexp="(?i)( 3-D,)" "" \
                           "(?i)( 3-D)" "" \
                           "(?i)( ERASE,)" "" \
                           "(?i)( ERASE)" ""
   #### code injection for controls ####
   # add the gradient color on all windows
    iscobol.compiler.gui.window.defaults= \
       gradient-color-1 rgb x#FFFFFF \
       gradient-color-2 rgb x#F2F5F9  \ 
       gradient-orientation gradient-northeast-to-southwest 
   # add the transparent style to all labels, check-boxes and radio-buttons
   iscobol.compiler.gui.label.defaults= transparent
   iscobol.compiler.gui.check_box.defaults= transparent
   iscobol.compiler.gui.radio_button.defaults= transparent
   iscobol.compiler.gui.frame.defaults= transparent
   # set the white color for all toolbars
   iscobol.compiler.gui.tool_bar.defaults= background-Color rgb x#FFFFFF \
                                           foreground-Color rgb x#000000
   # add the flat style to all push buttons
   # add the underline style to all entry-fields
   iscobol.compiler.gui.entry_field.defaults = border-width (0, 0, 2, 0) \
                                               border-color rgb x#DAE1E5
The screen is transformed to this more modern looking screen.

Authored by: Veryant Support This question has been viewed 2009 times so far.
Click Here to View all the questions in User Interface category.
File Attachments File Attachments
There are no attachment file(s) related to this question.
How helpful was this article to you?
User Comments User Comments Add Comment
There are no user comments for this question. Be the first to post a comment. Click Here
Related Questions Related Questions
  1. How to copy data from the clipboard
  2. How do I center a window on the desktop?
  3. UNC Paths with Browser Control don't work. What can I do to solve it?
  4. Does isCOBOL provide GUI design support?
  5. iscobol.font.default and DEFAULT-FONT
  6. What are the specific fonts that isCOBOL uses by default?
  7. Can I have an entry-field that more or less works the same as Google Search? So I would like to be able to change the contents of the list while the user is typing...
  8. Did you know isCOBOL has the Accordion control?
  9. Does isCOBOL provide Graph modules to show statistics?
  10. Is it possible to sort dates in a grid control?
  11. Working with a grid control is there a way to get the double-click event?
  12. How can I show an animated gif with isCOBOL?
  13. How can I refresh the current contents of the paged grid?
  14. Is there a way to show leading zeros when numeric data items are displayed on a character based screen?
  15. Did you know isCOBOL supports a tip inside the entry-field and combo-box controls when they are empty?
  16. Did you know how to customize color of the borders of some controls?
  17. Is it possible to configure the color of the read-only entry-fields?
  18. Did you know that you can protect a Grid from editing without coding any event?
  19. Gradient effects
  20. How to add pages and GUI controls inside them to a tab control dynamically?
  21. How to detect if a computer has more than one monitor and use any of them?
  22. Do isCOBOL GUI Screens have resizing capabilities?
  23. How may I display a notification window that requires no user intervention?
  24. How to deploy bitmaps when running in application server
  25. Can I modify the GUI controls of a Screen program from a called routine?
  26. How to use font-based icons in isCOBOL GUI programs
  27. Modernize your character application
  28. How to adjust program screens to different screen resolutions.
  29. How to add helpful options to the Status-Bar control
Article Information Additional Information
Article Number: 322
Created: 2021-11-04 2:35 AM
Rating: 5 Stars
Article Options Article Options
Print Question Print this Question
Email Question Email Question to Friend
Export to Adobe PDF Export to PDF File
Export to MS Word Export to MS Word
Bookmark Article
Subscribe to Article Subscribe to Article
Search Knowledge Base Search Knowledge Base


© Veryant - All Rights Reserved
Veryant and isCOBOL are trademarks or registered marks of Veryant in the United States and other countries. All other marks are the property of their respective owners.