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 > Did you know that you can protect a Grid from editing without coding any event?
Question Title Did you know that you can protect a Grid from editing without coding any event?

When a Grid resource (row, column or cell) has to be protected from editing, it's normal practice to
1. assign an event procedure to the Grid (if not yet available),
2. insert the handling of the MSG-BEGIN-ENTRY event,
3. check if the X/Y coordinates that generated the events match with the area you wish to protect and, if so
4. Make the event fail by setting the EVENT-ACTION registry

Despite not beeing wrong, this approach is not optimized especially in a thin client environment, as it generates client/server traffic for the event handling (the UI on the client informs the runtime on the server that an event occurred, the runtime responds that the event should fail and so the UI makes it fail).
There is a quicker and more optimized approach to protect a Grid area from editing. You can do it by setting one of the following properties to the value of "1".
- PROTECTION (to protect the whole Grid),
- ROW-PROTECTION (to protect one or more rows),
- COLUMN-PROTECTION (to protect one or more columns),
- CELL-PROTECTION (to protect one or more cells)

So, a code like this (written in the Grid Event Procedure):

  evaluate event-type
  when msg-begin-entry
  |first two columns are read-only
       evaluate event-data-1
       when 1
            set event-action to event-action-fail
       when 2
            set event-action to event-action-fail
       end-evaluate
  end-evaluate

Can be changed to:

  |first two columns are read-only
  modify screen-1-gr-1 x = 1, column-protection = 1
  modify screen-1-gr-1 x = 2, column-protection = 1

(written in the program Procedure Division, after the DISPLAY of the Grid)
And your program will be more optimized.

Authored by: Veryant Support This question has been viewed 623 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 do I center a window on the desktop?
  2. Does isCOBOL provide GUI design support?
  3. iscobol.font.default and DEFAULT-FONT
  4. What are the specific fonts that isCOBOL uses by default?
  5. Does isCOBOL provide Graph modules to show statistics?
  6. 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...
  7. Working with a grid control is there a way to get the double-click event?
  8. How can I refresh the current contents of the paged grid?
  9. Is there a way to show leading zeros when numeric data items are displayed on a character based screen?
  10. UNC Paths with Browser Control don't work. What can I do to solve it?
  11. Is it possible to sort dates in a grid control?
  12. How can I show an animated gif with isCOBOL?
  13. Is it possible to configure the color of the read-only entry-fields?
  14. Did you know isCOBOL supports a tip inside the entry-field and combo-box controls when they are empty?
  15. Did you know isCOBOL has the Accordion control?
  16. Did you know how to customize color of the borders of some controls?
Article Information Additional Information
Article Number: 275
Created: 2016-06-29 7:58 AM
Rating: No Rating
 
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.