Title: Construct Question Post by: Gary C. on May 01, 2017, 12:51:10 pm Hello
I have a need to initialise the form values when using a construct statement, in essence "remembering" the users previous search criteria when entering the dialog. Is this possible? I know I can read the field values but I am struggling to see how to set them. Thanks Title: Re: Construct Question Post by: Daniel N. on May 02, 2017, 11:13:35 am Hello
in our applications we automatically save the construct values in a table and offer the user a button to restore the last saved values. In AFTER CONSTRUCT we use the AUI Tree to find all elements that were part of the CONSTRUCT with SelectByPath("//*[@dialogType=\"Construct\"]") and search their Attributes "name" and "value" with getAttribute("name") and getAttribute("value"). If the user press the Button for "RestoreValues" we also use the AUI-Tree with the same SelectByPath and set the Attribute "value" with setAttribute("value") with the saved contents for all contruct fields. Title: Re: Construct Question Post by: Daniel N. on May 02, 2017, 12:23:43 pm Hello again
I don't know if you are familiy with AUI Tree. Attached please find the modified demo program Field.4gl and Field1.per to show how you can get and restore the construct values. Hope it helps. Title: Re: Construct Question Post by: Reuben B. on May 02, 2017, 01:56:00 pm I like Andreas generic code.
The methods ui.Dialog.setFieldValue http://4js.com/online_documentation/fjs-fgl-manual-html/#c_fgl_ClassDialog_setFieldValue.html and ui.Dialog.getFieldValue http://4js.com/online_documentation/fjs-fgl-manual-html/#c_fgl_ClassDialog_getFieldValue.html introduced in 3.00 could be used instead of the AUI tree reading and writing and would be safer in the long run. If you don't want to go down the generic code path then DISPLAY will do what you were after ... Code
Title: Re: Construct Question Post by: Gary C. on May 03, 2017, 09:02:07 am Hi
Thanks for your help Andrea/Reuben - I've got that working now. |