Four Js Development Tools Forum

Discussions by product => Genero BDL => Topic started by: Benjamin Garcia Vallejo on August 30, 2024, 10:36:23 AM

Title: DISPLAY ARRAY and DOUBLECLICK
Post by: Benjamin Garcia Vallejo on August 30, 2024, 10:36:23 AM
Hi,

Documentation says :  The DOUBLECLICK attribute defines the action for row choice on TABLE/TREE/SCROLLGRID rows.
But if the array is empty and you "DOUBLECLICK" the action is also fired ...

Tested with version fglrun 4.01.03 rev-3effeb69 and GBC 4.01.22

Regards
Title: Re: DISPLAY ARRAY and DOUBLECLICK
Post by: Sebastien FLAESCH on August 30, 2024, 11:43:01 AM
Hello,

Please provide a complete example or contact the support if you do not want to share your code in this public forum.

Where is the DOUBLECLICK attribute defined? In the .per or in the dialog?

What is the name of the action used by your DOUBLECLICK attribute?

The purpose of DOUBLECLICK in a TABLE is to select a row by going to a new current row and send the action.
See events in FGLGUIDEBUG=1 output, when there are rows in the table.

Should we blame the doc writer (me) or the way this feature has been designed when no rows are in the list?

I suggest that you define the action with ROWBOUND attribute:

Code (genero) Select
ON ACTION myaction ATTRIBUTES(ROWBOUND)

Seb
Title: Re: DISPLAY ARRAY and DOUBLECLICK
Post by: Reuben Barclay on August 30, 2024, 01:10:41 PM
I concur with Seb.

If you set DEFAULTVIEW=YES and experiment with and without ROWBOUND it may be a little clearer what is happening.  By looking in the action panel you can see when the action is active.

Code (genero) Select
    DISPLAY ARRAY arr TO scr.* ATTRIBUTES(DOUBLECLICK=foo)
        ON ACTION foo ATTRIBUTES(DEFAULTVIEW=YES)#, ROWBOUND)
            MESSAGE "Doube click, row=", arr_curr()
    END DISPLAY


You'll see that without ROWBOUND, the action is still active when there are no rows.  With ROWBOUND, the action is not active when there are no rows.
Title: Re: DISPLAY ARRAY and DOUBLECLICK
Post by: Benjamin Garcia Vallejo on August 30, 2024, 02:33:49 PM
I don't use explicity ROWBOUND nor DEFAULTVIEW ...
I've attached the source code, without line 320 and doubleclick on empty array error :

Fatal error -1326
An array variable has been referenced outside of its specified dimensions.
Program exited with code 1
764     LET FrmMrg.lnumart99   = FrmMrg.mrgval[curMrg].numart



regards
Title: Re: DISPLAY ARRAY and DOUBLECLICK
Post by: Sebastien FLAESCH on August 30, 2024, 02:56:44 PM
Benjamin,

We must discuss with the team if the current behavior is a bug or a feature.

In the meantime:

The variable curMrg certainly contains an invalid array index (0, NULL, <0)

Try to define the maj_marges action as ROWBOUND:

Code (genero) Select
ON ACTION maj_marges ATTRIBUTES(ROWBOUND)

Seb
Title: Re: DISPLAY ARRAY and DOUBLECLICK
Post by: Sebastien FLAESCH on August 30, 2024, 02:57:55 PM
If you don't want to use the ROWBOUND attribute for the maj_marges action, you will have to check all over the place that there are rows in the table/array.
Seb
Title: Re: DISPLAY ARRAY and DOUBLECLICK
Post by: Benjamin Garcia Vallejo on August 30, 2024, 03:13:58 PM
it's work with ROWBOUND in case of the doubleclick action is "maj_marges" ...
take a look at the second display array (sr_tlamrgcli) and you change doubleclick for action "ajout_marges" and with ROWBOUND on that action then the DOUBLECLICK doesn't fire if the table is empty ...

regards

Title: Re: DISPLAY ARRAY and DOUBLECLICK
Post by: Roland Wintgen on August 30, 2024, 03:21:36 PM
I usually use the following code with every BEFORE ROW or ON ACTION statement inside of a DISPLAY/INPUT ARRAY to check whether a row has been selected:

Code (genero) Select
BEFORE ROW
IF DIALOG.GetCurrentRow("ScreenArrayName") > 0
THEN do something
END IF


Kind regards
Roland