Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
MIBS20195 Absent Member.
Absent Member.
1463 views

Highlighting the result of a search in a grid cell

Is there a way to highlight a part of a grid cell.

I want to do a search and show the results in a grid and the text found I want to highlight or give a different color.

Is this possible?

0 Likes
4 Replies
Micro Focus Expert
Micro Focus Expert

RE: Highlighting the result of a search in a grid cell

There are a variety of grid properties that allow you to color grid cells, from

MODIFY Screen1-Gd-1, X = 1, Y = 2, CELL-COLOR = 69,

or use REGION-COLOR - if you take the sample gridctl.cbl and edit the   when msg-goto-cell-mouse to

                modify grid-1, region-color = 67

When you run the program and highlight cells in a column or row and column the color changes.

0 Likes
Micro Focus Expert
Micro Focus Expert

RE: Highlighting the result of a search in a grid cell

modify Screen1-Gd-1, start-x=x-2 x=4 start-y=y-2 y=4

          REGION-COLOR  "160"

this would give you a red background in cells x=2 y=2 and go through x=4 y=4

six cells changed

The start-x start-y is the property where the region begins and the x y property is where the region ends

0 Likes
rstoll Absent Member.
Absent Member.

RE: Highlighting the result of a search in a grid cell

We use a grid where the user can click on one row or more rows as the mouse drags down and the region color changes.  Here's the event procedure:

grid-1-handler.

     evaluate event-type

         when msg-begin-entry

              move 1 to sgl-item-selected-sw    

              move 0 to region-selected-sw  

              inquire grid-1 x in x-column

                             y in y-row

                     cell-data in cell-report-name        

              if x-column = 1

                 perform call-wordpad-paragraph

              end-if

***********event-action-fail prevents the cells from becoming active

              move event-action-fail to event-action

              modify grid-1 region-color = black

         when 16396

              move 1 to region-selected-sw        

              move 1 to sgl-item-selected-sw

              inquire grid-1 x in drag-start-column

                             y in drag-start-row

                     cell-data in cell-report-name

              modify grid-1 region-color = black  

              move drag-start-row to drag-end-row

                                     present-row-number  

              move drag-start-column to drag-end-column

                                        present-column-number  

         when msg-begin-drag

              move 1 to region-selected-sw

              move 0 to sgl-item-selected-sw

              inquire grid-1 x in drag-start-column

                             y in drag-start-row  

         when msg-goto-cell-drag

              modify grid-1  

                     region-color = 175

              move 1 to region-selected-sw

              move 0 to sgl-item-selected-sw

         when msg-end-drag

              move 1 to region-selected-sw

              move 0 to sgl-item-selected-sw

              modify grid-1 region-color = 175                

              inquire grid-1 x in drag-end-column

                             y in drag-end-row

              move drag-end-column to present-column-number

              move drag-end-row    to present-row-number

         when other

       end-evaluate.

0 Likes
MIBS20195 Absent Member.
Absent Member.

RE: Highlighting the result of a search in a grid cell

Ok I will try this.

Thank you.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.