Subscribe for automatic updates: RSS icon RSS

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

Pages: [1]
  Reply  |  Print  
Author Topic: DISPLAY ARRAY and DOUBLECLICK  (Read 1278 times)
Benjamin G.
Posts: 130


« 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
Sebastien F.
Four Js
Posts: 545


« Reply #1 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
  1. ON ACTION myaction ATTRIBUTES(ROWBOUND)

Seb
Reuben B.
Four Js
Posts: 1114


« Reply #2 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
  1.    DISPLAY ARRAY arr TO scr.* ATTRIBUTES(DOUBLECLICK=foo)
  2.        ON ACTION foo ATTRIBUTES(DEFAULTVIEW=YES)#, ROWBOUND)
  3.            MESSAGE "Doube click, row=", arr_curr()
  4.    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.

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


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

* sample_code.ZIP (20.45 KB - downloaded 147 times.)
Sebastien F.
Four Js
Posts: 545


« Reply #4 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
  1. ON ACTION maj_marges ATTRIBUTES(ROWBOUND)

Seb
Sebastien F.
Four Js
Posts: 545


« Reply #5 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
Benjamin G.
Posts: 130


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

Roland W.
Posts: 22


« Reply #7 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
  1. BEFORE ROW
  2. IF DIALOG.GetCurrentRow("ScreenArrayName") > 0
  3. THEN do something
  4. END IF

Kind regards
Roland
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines