Hiding Folder Page

Started by Gary C., July 28, 2017, 10:27:10 AM

Previous topic - Next topic

Gary C.

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 (genero) Select

FOLDER fldr_details

  PAGE pg_clr (text=%"Colours", action=pageclr)
   GRID grid_col
   {
   <T tabcol                                                                                                                           >
    [sc01  |fc01      |fc02      |fc03      |fc04      |fc05      |fc06      |fc07      |fc08      |fc09      |fc10      ]
   <                                                                                                                                      >
    [lc01                          ][bc00|bc01|bc02  ]
   }
   END -- GRID
  END -- PAGE


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

Reuben B.

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 (genero) Select
BEFORE DIALOG
  IF page1 hidden THEN
     CALL DIALOG.setNextField("scr2.field")
     CALL ui.Form.setElementHidden("page1")
   END IF


to shift focus before page is hidden.

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

Code (genero) Select
BEFORE INPUT  -- before input array
   CALL DIALOG.setActionActive("hidePageX", FALSE)

AFTER INPUT
   CALL DIALOG.setActionActive("hidePageX", TRUE)


Reuben

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero

Gary C.

Thanks Reuben

Shifting focus prior to hiding has solved the problem.

Many thanks

Gary