Title: DISPLAY ARRAY and ON INSERT Post by: Benjamin G. on June 28, 2024, 11:48:55 am Hello,
Documentation point that with "ON INSERT" we can define ATTRIBUTES (eg : ON ACTION insert ATTRIBUTES(TEXT="Ajouter règle
Maybe there is a conflict with action defaults and/or toolbar ? Thanks for help me Regards Title: Re: DISPLAY ARRAY and ON INSERT Post by: Sebastien F. on June 28, 2024, 03:07:45 pm Hello,
Just tested with FGL 4.01.07 and works as expected. Code
Pay attention to the fact that decoration attributes (TEXT, IMAGE) specified in ATTRIBUTES clause of ON ACTION only apply to default action views and context menu action views. We could better help if you provide a sample and all versions of Genero products that you use. You may want to contact the support for that. Seb Title: Re: DISPLAY ARRAY and ON INSERT Post by: Benjamin G. on June 29, 2024, 01:26:02 pm Hi,
version fglrun 5.00.02 rev-025d702c attached source file with sample (zip) on actions test1 works perfect on insert doesn't allow "rowbound" and you can see that contextmenu is not populated with the action ... regards Title: Re: DISPLAY ARRAY and ON INSERT Post by: Benjamin G. on June 29, 2024, 01:43:48 pm but if in the display array you use ON DELETE / ON UPDATE then rowbound context menu is filled but for on insert and on append isn't (see sample)
i can understand that rowbound are the actions for and only for the current row but "insert and append" are also a logical action ... Title: Re: DISPLAY ARRAY and ON INSERT Post by: Sebastien F. on June 30, 2024, 10:03:56 am Hello Ben,
I think you are confusing (A) the rowbound-actions popup menu that opens when you click on the 3-dots on the right of a row, with (B) the context menu that opens when you right-click somewhere in the table. The "insert" / ON INSERT and "append" / ON APPEND actions will not appear in (A) because these are not "rowbound" actions. However, they can appear in (B), and this is controlled with the CONTEXTMENU attribute. By design/definition, rowbound actions get decorated in (A), but you cannot make non-rowbound actions appear in (A). I suppose this is what you are looking for. Doc links: https://4js.com/online_documentation/fjs-fgl-manual-html/index.html#fgl-topics/c_fgl_prog_dialogs_rowbound_actions.html https://4js.com/online_documentation/fjs-fgl-manual-html/index.html#fgl-topics/c_fgl_action_attribute_ROWBOUND.html https://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_prog_dialogs_contextmenu.html Note that we have a ticket to control the visibility of rowbound actions in (A): https://4js.com/support/issue/?id=FGL-05757#startissue But this would not help since it's only to hide the view of a rowbound action. Seb Title: Re: DISPLAY ARRAY and ON INSERT Post by: Benjamin G. on June 30, 2024, 05:39:20 pm Thank you for replying
Title: Re: DISPLAY ARRAY and ON INSERT Post by: Benjamin G. on June 30, 2024, 06:01:52 pm There's something that i don't understand, how do you define a "context menu" with GBC, when i "rigth click" on the table i only get the "chrome popup menu" ...
If i define the style "window.actionPanelPosition=chrome" then action "insert" is added in the chromebar but i can't get a "popup" with the actions I missed a parater somewhere but i don't find where ... thanks for help me Title: Re: DISPLAY ARRAY and ON INSERT Post by: Reuben B. on July 01, 2024, 01:31:59 am There's something that i don't understand, how do you define a "context menu" with GBC, when i "rigth click" on the table i only get the "chrome popup menu" ... If i define the style "window.actionPanelPosition=chrome" then action "insert" is added in the chromebar but i can't get a "popup" with the actions I missed a parater somewhere but i don't find where ... thanks for help me See https://4js.com/online_documentation/fjs-gbc-manual-html/#gbc-topics/t_gbc_display_context_menu.html Can I ask what phrase you searched on and/or where you searched? (reason I ask is to improve documentation search by slipping alternate words into the documentation so that it gets found, normally it is the 3-dots, three dots, triple dots, rowbound popupmenu that gets missed because of the variety of terms for it). Title: Re: DISPLAY ARRAY and ON INSERT Post by: Reuben B. on July 01, 2024, 02:12:00 am There is another point in this discussion that has been glossed over and perhaps needs examining. Seb said ...
Quote "The "insert" / ON INSERT and "append" / ON APPEND actions will not appear in (A) (the rowbound popup menu) because these are not "rowbound" actions. However, they can appear in (B) (the context menu), and this is controlled with the CONTEXTMENU attribute. This is documented here https://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_prog_dialogs_rowbound_actions.html Quote In DISPLAY ARRAY, the actions created from modification triggers ON UPDATE and ON DELETE are automatically defined as rowbound actions. Actions for ON INSERT and ON APPEND are not considered as specific to a row. The actions defined with the ROWBOUND attribute will be available by selecting the three-dots button on the right of a table row. The product is doing what it has been designed to do . The question you might be asking is, should the append and insert also be considered "rowbound" actions? , that is should they be "considered as specific to a row" ? For append, the answer is a clear no, it is not insert a row after the current row, it is append a row at the end of the array. It can not be "considered as specific to a row". For insert, the answer is currently no, but it is not as clear cut. You could argue that for a populated array, insert adds a row before the current row, therefore insert should be "considered as specific to a row". However consider an empty array, rowbound actions are not active in an empty array therefore if insert was rowbound it would not be active in an empty array. Append would be, insert wouldn't. There is also a complication in what if the array has been sorted? Should the new row be displayed visually where the user was when they chose insert row, or should it appear in the correct position in the sort?. If it is in the correct position, then was the original action truly a rowbound one? is it simpler when the user has sorted the array to disable insert and only allow append? There is also the discussion, should we have "insert after" as well as the existing "insert [before]" ? So at the moment, the status quox is maintained and ON INSERT is not considered rowbound. For it to be considered rowbound, this would require an enhancement. These topics would have been discussed when DISPLAY ARRAY + CRUD modification triggers were added in 2.40, and ROWBOUND attribute was added in 2.51. What you can try is to code your own rowbound insert with something like ... Code
Reuben Title: Re: DISPLAY ARRAY and ON INSERT Post by: Sebastien F. on July 01, 2024, 08:11:18 am Reuben,
You wrote: Quote So at the moment, the status quo is maintained and ON INSERT is not considered rowbound. As far as I known, there is no status quo about this here for the FGL dev team. While I can understand the idea that insert is typically to insert are row before another existing row, I4GL legacy forces us to make insert always active, even when there is no row in the array. Consequently, it cannot be considered as "rowbound". I think the main point for Ben is to give access to insert/append actions from a popup menu. Since these cannot be shown in the 3-dots menu, they are only accessible from the context menu, which is not enabled by default when using GAS/browser as you mentioned. It is available by default when using GDC/UR/GBC. Seb Title: Re: DISPLAY ARRAY and ON INSERT Post by: Sebastien F. on July 01, 2024, 08:19:23 am Reuben,
We should double check you workaround before proposing to customers. First remark: you need to reset int_flag before the INPUT: Code
Seb Title: Re: DISPLAY ARRAY and ON INSERT Post by: Sebastien F. on July 01, 2024, 09:04:05 am Understand also the main purpose of ROWBOUND actions: See the warning in
https://4js.com/online_documentation/fjs-fgl-manual-html/index.html#fgl-topics/c_fgl_prog_dialogs_rowbound_actions.html I copy the text here, to make sure that it's clear to everyone: Quote Important: SebThe main purpose of the ROWBOUND attribute is to have the corresponding action enabled and disabled automatically by the runtime system, depending on the existence of a row. The default decoration of such action is front-end platform driven and is the consequence of using the ROWBOUND action attribute. A DISPLAY ARRAY or INPUT ARRAY can be used with a plain form that show a single row at a time. The rowbound actions can also be used in such case, using form buttons as action views for example. These buttons will be automatically enabled/disabled according to the list content. Title: Re: DISPLAY ARRAY and ON INSERT Post by: Benjamin G. on July 01, 2024, 09:42:55 am Thank your for all the explanation.
For us the behaviour of the rowbound is ok and logical. Our problem was displaying the "context menu" with GBC. We have searching the BDL documentation with "displaying context menu" but there is no reference to the GBC docs. (Maybe BDL docs and GBC docs must be sometimes linked) Thank you very much Sebastien and Reuben Title: Re: DISPLAY ARRAY and ON INSERT Post by: Reuben B. on July 01, 2024, 09:48:40 am Reuben, We should double check you workaround before proposing to customers. First remark: you need to reset int_flag before the INPUT: Code
Seb Seb, There are two schools of thought in the 4gl community regarding the use of int_flag and when to make sure it is set to 0. I was brought up in the school where you tidy up after yourself and reset int_flag back to 0 at the conclusion of each dialog, thus minimising the time it has a dirty value. Reuben Title: Re: DISPLAY ARRAY and ON INSERT Post by: Benjamin G. on July 01, 2024, 09:52:50 am Remarks ...
The sample proposed by Reuben was the solution that we've initially programmed but this is not really a good solution because of sort problem ... If you try that cod after the "on action my_insert" is validated and the array is sorted the new row "dissapear" from the screen and for the end user is very strange ... With the "ON INSERT" the row stay at the position inserted until the display array is refreshed Regards Title: Re: DISPLAY ARRAY and ON INSERT Post by: Sebastien F. on July 01, 2024, 09:54:49 am Hi Ben,
About docs you are absolutely right some hint was missing in the BDL doc. We have now added a tip. See attachment. Seb Title: Re: DISPLAY ARRAY and ON INSERT Post by: Sebastien F. on July 01, 2024, 09:56:07 am About the doc you are right, we have now added a tip, see attachment.
Seb Title: Re: DISPLAY ARRAY and ON INSERT Post by: Benjamin G. on July 02, 2024, 02:54:55 pm Remarks ...
The sample proposed by Reuben was the solution that we've initially programmed but this is not really a good solution because of sort problem ... If you try that cod after the "on action my_insert" is validated and the array is sorted the new row "dissapear" from the screen and for the end user is very strange ... With the "ON INSERT" the row stay at the position inserted until the display array is refreshed Regards Title: Re: DISPLAY ARRAY and ON INSERT Post by: Reuben B. on July 03, 2024, 12:53:59 am Remarks ... The sample proposed by Reuben was the solution that we've initially programmed but this is not really a good solution because of sort problem ... If you try that cod after the "on action my_insert" is validated and the array is sorted the new row "dissapear" from the screen and for the end user is very strange ... With the "ON INSERT" the row stay at the position inserted until the display array is refreshed Regards My example probably should have a DIALOG.setCurrentRow("scr", r) at the end to set the current row in the array to the row that has just been inserted. However you said "... and the array is sorted ...". I would be curious as to how at this point you do your sort. Is the user clicking slowly twice on the header to redo the sort, or are you calling array.sort() ? You should also note the existence of an fglprofile entry "currentRowVisibleAfterSort" https://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_fglprofile_004.html. Default value is false. If you set this to true, add the line above to set the current row to the line just added, then after inserting the row if you redo the sort by clicking slowly twice on the column header, then I think you will see what you want to see. If you have explicitly added an array.sort(), then you might not get results you anticipate, for the same reasons that you use DIALOG.insertRow and not array.insertElement. Perhaps we should have a DIALOG.reapplySort so that the user does not have to slowly click twice on the header ... Reuben Title: Re: DISPLAY ARRAY and ON INSERT Post by: Benjamin G. on July 24, 2024, 02:12:34 pm Hi,
I don't understand why with a DISPLAY ARRAY and on action handler using DIALOG.insertrow() just after arr_curr()/scr_line() returned values are different from DIALOG.getCurrentRow() and DIALOG.arrayToVisualIndex(). There is always a gap from 1 between the values ... eg : if the cursor array is on the line number 3 arr_curr() and scr_line() return 3 but getcurrentrow()and arraytovisualindex return 4 after the insertrow() is there any explanation about this difference ? Regards Title: Re: DISPLAY ARRAY and ON INSERT Post by: Sebastien F. on July 26, 2024, 10:21:48 am Benjamin,
Please provide a code example next time. If you want to implement your own action handler to insert a row, you should do following: Code
However, why are you doing this? Is ON INSERT of DISPLAY ARRAY not good for you? Please explain the reasons why you want to write your own action handler to insert rows. Seb Title: Re: DISPLAY ARRAY and ON INSERT Post by: Benjamin G. on July 26, 2024, 11:15:22 am Hi Sebastien,
The reason of using a custom action is that the user can choose between "insert one" or "insert multiple" records in the array ... It would be nice that if we could call an "on action" programatically eg. : Display array ..... on insert code .... on myaction insertone execute "on insert" on myaction insertmultiple while not stop execute "on insert" end while end display i will try with the "setcurrentrow" after insertrow ... but it seems to me not logical regards Title: Re: DISPLAY ARRAY and ON INSERT Post by: Benjamin G. on July 26, 2024, 11:20:51 am Hi,
calling setcurrentrow after insertrow work's ... regards |