Title: Detecting click in a field Post by: Lu?s T. on September 05, 2019, 06:45:07 pm I want to the following:
* display a record * detect when the user click in a field Suppose you have a invoice, where you the field customer. I want to display the form with the invoice and, if the user clicks in the field customer, open the customer form. Ho do I do this? Thanks Luis Title: Re: Detecting click in a field Post by: Reuben B. on September 10, 2019, 02:09:46 am There are a few approaches you can consider.
If you want to stick with a MENU, then you can make the fields a BUTTON using the presentation style buttonType=link, and use the ui.Form.setElementText method to render the field value (in your example the customer code and/or name) as the button text. This will display the value with an underline like a link and provide a hint to the end-user they can click on this field and something will happen So something like 4gl Code
Form Code
and 4st Code
if you don't mind using an INPUT then you also can use a NOTEDITABLE BUTTONEDIT. This will display the value and have a small button to the right of the field the user can click on to get detail or drill down Code
Code
A more complex technique if you are using GBC and/or Universal Rendering would be to explore some customisation that uses the onClick Javascript event (or onDblClick or onMouseOver etc) for the field/widget that sends the action back. However you would not want to get in the way of the existing events that move focus to the field in an INPUT etc) What you also have to note is that a MENU has no concept of current field. So note in the above examples, the MENU example using a BUTTON has a different action for each field, whilst the INPUT example is able to use a single ON ACTION and FGL_DIALOG_GETFIELDNAME() to determine what the 4gl field focus is. I am also conscious that none of those techniques allow you to share a form between an input view and a readonly view. Reuben Title: Re: Detecting click in a field Post by: Lu?s T. on September 10, 2019, 07:15:38 pm Thanks a lot Reuben. Very useful information.
As I am using a DIALOG, which doesn't not allow a MENU as a sub-dialog, I opt to do a DISPLAY with buttons in place of the fields. Something like: Code: DISPLAY BY NAME ... The way I find to share the same form for DISPLAY and INPUT was to replace dinamically the form fields by buttons. Perhaps not very supported but I isolated that in a function. I have one more questions for you (or whoever have a solution). How to make a display array react when I click a row (like a weblink)? I already figure out how to do it using double click but I rather prefer a single click. More consistent with web interfaces. To illustrate the idea thing about a client FORM, where I have a detail with his contracts. I would like the user to click in a row and open the contract FORM. I suppose this should be easier than my first question. Thanks in advance Luis Title: Re: Detecting click in a field Post by: Reuben B. on September 11, 2019, 01:15:09 am Quote How to make a display array react when I click a row (like a weblink)? I already figure out how to do it using double click but I rather prefer a single click. More consistent with web interfaces. Have a look at the rowActionTrigger presentation style http://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/r_fgl_presentation_styles_table_style_attributes.html Title: Re: Detecting click in a field Post by: Lu?s T. on September 12, 2019, 04:00:47 pm Once more thanks Reuben.
I read the documentation and tried to put that working without success. I can change the test color but not the click behaviour. I suppose I am missing sometthing. Here is the code: Main 4gl Code: define paXYZ dynamic array of record a, b string end record Per file Code: layout And 4st file Code: <StyleList> Do you see anything wrong or missing? I am testing with the GDC in Universal Rending Mode. Title: Re: Detecting click in a field Post by: Reuben B. on September 12, 2019, 11:32:56 pm Your code worked for me. You did npt have anything to indicate success (apart from the array exiting), so perhaps you just need to add ...
Code
Reuben Title: Re: Detecting click in a field Post by: Lu?s T. on September 16, 2019, 10:13:35 am The success was array exiting and, consequently, program end. In any case I add the after display clause and confirm that it only leaves with double click.
I am using Genero Desktop Client Version 3.20.08 build-201907311127, enabling Universal Rendering as the default rendering. In terms of compiler, I have fglcomp 3.20.05 rev-3e07ac75, Target a640710. Do you think I should open an ticket? Title: Re: Detecting click in a field Post by: Reuben B. on September 17, 2019, 12:03:47 am The success was array exiting and, consequently, program end. In any case I add the after display clause and confirm that it only leaves with double click. I am using Genero Desktop Client Version 3.20.08 build-201907311127, enabling Universal Rendering as the default rendering. In terms of compiler, I have fglcomp 3.20.05 rev-3e07ac75, Target a640710. Do you think I should open an ticket? Please don't hesitate to open a ticket. What you may want to experiment is running GDC native, that might tell you if issue lies with UR. I don't think I have accidentally corrected anything in copying your code, the textColor=Red should tell you if it is picking up the right .4st, as would investigating the AUI Tree. The other thing that I might speculate on is the PC touch enabled? / does the Table appear as listView by default, or perhaps are you misinterpreting that one click is initially required to set Windows focus to the GDC window (to see if this is the case make the first click outside the table, and then do your single click inside the table) Title: Re: Detecting click in a field Post by: Lu?s T. on September 17, 2019, 06:12:42 pm Hi Reuben,
I uninstalled and reinstalled the GDC and it works now. Probably something went wrong with the previous installation. Thanks for your help Luis |