Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1] 2
  Reply  |  Print  
Author Topic: DISPLAY ARRAY and ON INSERT  (Read 2978 times)
Benjamin G.
Posts: 124


« 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 [+]", IMAGE="fa-var-add", ACCELERATOR="+", CONTEXTMENU=YES,DEFAULTVIEW=no) )
The accelerator seems to work but the TEXT and CONTEXTMENU=yes seems not working
Maybe there is a conflict with action defaults and/or toolbar ?

Thanks for help me

Regards
Sebastien F.
Four Js
Posts: 528


« Reply #1 on: June 28, 2024, 03:07:45 pm »

Hello,

Just tested with FGL 4.01.07 and works as expected.

Code
  1.        ON INSERT ATTRIBUTES(TEXT="INSERT! [+]"
  2.                             ,IMAGE="fa-cogs"
  3.                             ,ACCELERATOR="+"
  4.                             ,COMMENT="Insert a new row!"
  5.                             ,CONTEXTMENU=YES
  6.                             --,CONTEXTMENU=NO
  7.                             ,DEFAULTVIEW=NO
  8.                             --,DEFAULTVIEW=NO
  9.                             )
  10.  

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
Benjamin G.
Posts: 124


« Reply #2 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


* sample2.png (49.7 KB, 865x769 - viewed 297 times.)

* sample1.png (30.07 KB, 861x664 - viewed 315 times.)
* onaction.zip (9.47 KB - downloaded 160 times.)
Benjamin G.
Posts: 124


« Reply #3 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 ...


* sample 3.png (34.38 KB, 1474x760 - viewed 310 times.)
Sebastien F.
Four Js
Posts: 528


« Reply #4 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





 


* rowbound-3dots-menu.png (58.78 KB, 798x552 - viewed 299 times.)

* context-menu.png (61.38 KB, 806x555 - viewed 310 times.)
Benjamin G.
Posts: 124


« Reply #5 on: June 30, 2024, 05:39:20 pm »

Thank you for replying
Benjamin G.
Posts: 124


« Reply #6 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
Reuben B.
Four Js
Posts: 1099


« Reply #7 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).











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


« Reply #8 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
  1. DISPLAY ARRAY arr TO scr.*
  2.  
  3.        ON ACTION my_insert ATTRIBUTES(ROWBOUND, TEXT="Insert", DEFAULTVIEW=NO)
  4.            LET r = arr_curr()
  5.            LET s = scr_line()
  6.            CALL DIALOG.insertRow("scr",r)
  7.  
  8.            INPUT arr[r].* FROM scr[s].*;
  9.            IF int_flag THEN
  10.                LET int_flag = 0
  11.                CALL DIALOG.deleteRow("scr",r)
  12.            END IF
  13.  
  14.       ON UPDATE
  15.           ...
  16.       ON DELETE
  17.          ...
  18.       ...
  19.  








Reuben

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


« Reply #9 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
Sebastien F.
Four Js
Posts: 528


« Reply #10 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
  1.    ON ACTION my_insert ATTRIBUTES(ROWBOUND, TEXT="My Insert", DEFAULTVIEW=NO)
  2.        VAR r = arr_curr()
  3.        VAR s = scr_line()
  4.        CALL DIALOG.insertRow("sr_onaction",r)
  5.        LET int_flag = FALSE                                      <----- HERE
  6.        INPUT mr_onaction[r].* FROM sr_onaction[s].*;
  7.        IF int_flag THEN
  8.            CALL DIALOG.deleteRow("sr_onaction",r)
  9.        END IF

Seb
Sebastien F.
Four Js
Posts: 528


« Reply #11 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:
The 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.
Seb
Benjamin G.
Posts: 124


« Reply #12 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
Reuben B.
Four Js
Posts: 1099


« Reply #13 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
  1.    ON ACTION my_insert ATTRIBUTES(ROWBOUND, TEXT="My Insert", DEFAULTVIEW=NO)
  2.        VAR r = arr_curr()
  3.        VAR s = scr_line()
  4.        CALL DIALOG.insertRow("sr_onaction",r)
  5.        LET int_flag = FALSE                                      <----- HERE
  6.        INPUT mr_onaction[r].* FROM sr_onaction[s].*;
  7.        IF int_flag THEN
  8.            CALL DIALOG.deleteRow("sr_onaction",r)
  9.        END IF

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





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


« Reply #14 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
Pages: [1] 2
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines