Question Cross-reference In Browse Widget With Blocked Cells

Osmar Morais

New Member
I need to create a cross-reference application in which the lines will be the colors and the columns will be the size of a particular textile product. The problem is that can not exist an item (SKU) for all the cells, and in these cases, I would like to block those cells to avoid improper data-entry, but I can not do this with the BROWSE widget. I would like to use something like the ENABLE/DISABLE for each one of these improper cells, but I only manage do use these statements with fields/widgets and I need to apply on specific cells. Someone can help me with this problem?
 

Cringer

ProgressTalk.com Moderator
Staff member
Can't get a precise solution for you at the moment but you need to look at the READ-ONLY attribute on the column handle. I think you change it in the value-changed trigger of the browse widget.
 

Osmar Morais

New Member
Can't get a precise solution for you at the moment but you need to look at the READ-ONLY attribute on the column handle. I think you change it in the value-changed trigger of the browse widget.
Thanks for your tip but in this case all cells of this column would be affected and I need to block or allow each cell individually, because for some colors would not have all sizes.
 

Cringer

ProgressTalk.com Moderator
Staff member
I still can't find the exact solution, but you set the READ-ONLY attribute on one of the triggers. It might be on entry thinking about it. I don't have the code in front of me as it was a previous job, but we used to do it successfully as you describe.
 

Fabio

New Member
Hello Osmar,

Write the "EnableCell" procedure, like below:

Code:
PROCEDURE EnableCell :
/*------------------------------------------------------------------------------
  Purpose:    
  Parameters:  <none>
  Notes:      
------------------------------------------------------------------------------*/

  DEF INPUT PARAM hBrowser AS HANDLE NO-UNDO.
  DEF INPUT PARAM cCols    AS CHAR   NO-UNDO.
  DEF INPUT PARAM lEnable  AS LOG    NO-UNDO.

  DEF VAR hCol             AS HANDLE NO-UNDO.

  IF VALID-HANDLE(hBrowser) THEN DO:
  
    hCol = hBrowser:FIRST-COLUMN.
  
    DO WHILE VALID-HANDLE(hCol):

      IF CAN-DO(cCols, hCol:NAME) THEN
        hCol:READ-ONLY = NOT lEnable.

      hCol = hCol:NEXT-COLUMN.

    END.

  END.

END PROCEDURE.


And on value-changed of your browser widget do something like this:

Code:
/*
 * The 2nd parameter in the "EnableCell" is a comma separated  
 * string of columns that you want to enable/disable.
 *
 */
IF <YOUR-CONDITION-TO-DISABLE> THEN
  RUN EnableCell(yourBrowserName:HANDLE, 'column-name-1,column-name-2,column-name-n', FALSE).
ELSE
  RUN EnableCell(yourBrowserName:HANDLE, 'column-name-1,column-name-2,column-name-n', TRUE).


Best regards,
 

Osmar Morais

New Member
Thanks Fabio and Cringer, both gave me the solution I needed by setting the READ-ONLY attribute in the ROW-ENTRY of the browse. Works perfectly. It was easier than it looked at first . Well done!
 
Top