Four Js Development Tools Forum

Discussions by product => Genero BDL => Topic started by: Gary C. on July 28, 2017, 10:27:10 am



Title: Hiding Folder Page
Post by: Gary C. on July 28, 2017, 10:27:10 am
Hi

I have a form that contains a folder element, within which there are three pages. Each page has a table, some labels and buttons. Below is an extract:

Code
  1. FOLDER fldr_details
  2.  
  3.  PAGE pg_clr (text=%"Colours", action=pageclr)
  4.   GRID grid_col
  5.   {
  6.    <T tabcol                                                                                                                           >
  7.     [sc01  |fc01      |fc02      |fc03      |fc04      |fc05      |fc06      |fc07      |fc08      |fc09      |fc10      ]
  8.    <                                                                                                                                      >
  9.     [lc01                          ][bc00|bc01|bc02  ]
  10.    }
  11.   END -- GRID
  12.  END -- PAGE
  13.  

Within my 4gl I have a dialog block with three input array statements. There are some scenarios where I wish to hide a page from the user and I am using the ui.Form.setElementHidden method to achieve this.

However, I then get a runtime error:

FORMS statement error number -8092.
At least one field for this INPUT ARRAY must be editable.

Is my approach correct and is there a method I can use to hide a folder page with an associated input array statement?

Many thanks

Gary


Title: Re: Hiding Folder Page
Post by: Reuben B. on July 31, 2017, 01:12:53 am
Your approach is correct.  I created a small test and I got the same error as you only if I  tried to hide the PAGE that contained the current INPUT ARRAY with focus.  If the PAGE you were trying to hide contained an INPUT ARRAY that was not the current focus element then that PAGE could be hidden.

The error message predates Multi-Dialog and prevents you hiding every column of an INPUT ARRAY, or else you end up in a situation where there is no element to attach the focus  (the INPUT ARRAY does not magically turn into a DISPLAY ARRAY in such circumstances).  Wether it should apply here or not I'll leave upto the development team. 

I note that if you have two fields in an INPUT, you can hide the field that has the focus and focus moves to the next field in the tabindex, so you could argue that the same could apply here.  If you have two INPUT ARRAY's in a multi dialog, should you be able to hide the first INPUT ARRAY if that has the focus and have the focus move to the second INPUT ARRAY?  However note what happens with any field or row validation, typically you will place the cursor back in that field, and this is problematic if you have just hidden it. 

My current thought is that you should avoid attempting to hide the page containing the INPUT ARRAY that has the focus.  So if trying to hide the first page on initial entry, then you may need

Code
  1. BEFORE DIALOG
  2.  IF page1 hidden THEN
  3.     CALL DIALOG.setNextField("scr2.field")
  4.     CALL ui.Form.setElementHidden("page1")
  5.   END IF

to shift focus before page is hidden.

and then logic such as to disable hiding of the current page

Code
  1. BEFORE INPUT  -- before input array
  2.   CALL DIALOG.setActionActive("hidePageX", FALSE)
  3.  
  4. AFTER INPUT
  5.   CALL DIALOG.setActionActive("hidePageX", TRUE)
  6.  

Reuben



Title: Re: Hiding Folder Page
Post by: Gary C. on July 31, 2017, 03:04:15 pm
Thanks Reuben

Shifting focus prior to hiding has solved the problem.

Many thanks

Gary