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: Menu As Part Of A Dialog  (Read 2122 times)
Sean H.
Posts: 18


« on: January 27, 2022, 04:43:15 pm »

I was reading through the online documentation, specifically this page
https://4js.com/online_documentation/fjs-fgl-3.10.00-manual-html/#fgl-topics/c_fgl_DIALOG_subdialog_MENU.html

I am trying to do the same thing and use a menu inside of a dialog

   dialog attributes(unbuffered)

      display array someArray to screenTable.*
      end display

      menu
         on action exit
            exit dialog
      end menu

   end dialog


It's giving me the error

      menu
| A grammatical error has been found at 'menu' expecting: AFTER BEFORE COMMAND END ON.
| See error number -6609.
         on action exit
            exit dialog
      end menu


I'm a bit confused on how to get this working. I know I can just use the action directly like this

   dialog attributes(unbuffered)

      display array someArray to screenTable.*
      end display

      on action exit
         exit dialog

   end dialog


The problem is that I must have at least one display array or input etc inside the dialog or it won't work.

   dialog attributes(unbuffered)

      on action exit
         exit dialog

   end dialog


This will fail.
Sebastien F.
Four Js
Posts: 487


« Reply #1 on: January 27, 2022, 05:20:40 pm »

Hello Sean,

Please consider using the latest V4.00 documentation to get most recent doc bug fixes:

    https://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_form_controllers.html

I think you are confused by the concepts of declarative dialog blocks vs procedural dialog blocks.

If you only want to control a simple set of action views with no field input or list handling, use the good old MENU instruction:
Code
  1. MENU ...
  2.  ON ACTION xyz
  3.    ...
  4.  COMMAND "xyz"
  5.    ...
  6. END MENU
https://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_menus_002.html

If you want to add action handlers in a procedural dialog block, add ON ACTION or COMMAND clauses at the DIALOG level:
Code
  1. FUNCTION...
  2.  ...
  3.  DIALOG
  4.     INPUT BY NAME ...
  5.         ...
  6.     END INPUT
  7.     ON ACTION xyz       <-- here
  8.          ...
  9.  END DIALOG
  10.  ...
  11. END FUNCTION
https://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_multiple_dialogs_intro.html

If you want to reuse sub-dialog blocks in different procedural dialogs, use declarative dialog blocks:
Code
  1. DIALOG menu1()
  2.  MENU ...
  3.    ...
  4.  END MENU
  5. END DIALOG
  6.  
  7. FUNCTION func()
  8.   DIALOG
  9.      INPUT BY NAME ...
  10.           ...
  11.      END INPUT
  12.      SUBDIALOG menu1
  13.   END DIALOG
  14. END FUNCTION
https://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_declarative_dialogs_intro.html


Seb
Sean H.
Posts: 18


« Reply #2 on: January 27, 2022, 05:52:10 pm »

The last example of reusing dialogs is the closest to what I am looking I'm just a bit confused about how the subdialog references the parent dialog.

I updated the code to match yours.

dialog dialogMenu()

   menu

      on action add
         message "Add Exe"

      on action exit
         exit dialog

   end menu

end dialog

function dialogDisplay()

   dialog attributes(unbuffered)

      display array someArray to screenTable.*
      end display

      subdialog dialogMenu

   end dialog

end function


It looks like the buttons/actions have now become available but the exit doesn't seem to be exiting the dialog, or I just don't know which dialog is being targeted for the exit.
I added a second action just to test and that one doesn't seem to be displaying the message, am I missing some steps?
Sebastien F.
Four Js
Posts: 487


« Reply #3 on: January 27, 2022, 06:13:12 pm »

Seems we have a bug here with SUBDIALOG using a declarative dialog with MENU. We will investigate.

I suggest that you use directly ON ACTION clauses in your procedural DIALOG:

Code
  1. function dialogDisplay()
  2.  
  3.   dialog attributes(unbuffered)
  4.  
  5.      display array someArray to screenTable.*
  6.      end display
  7.  
  8.      on action add
  9.         message "Add Exe"
  10.  
  11.      on action exit
  12.         exit dialog
  13.  
  14.   end dialog
  15.  
  16. end function
Sean H.
Posts: 18


« Reply #4 on: January 27, 2022, 06:19:34 pm »

Ok, thanks so much for getting back to me and all your assistance though.
Sebastien F.
Four Js
Posts: 487


« Reply #5 on: January 30, 2022, 10:58:19 am »

You are welcome, bug FGL-5713 created.
Seb
Rene S.
Four Js
Posts: 103


« Reply #6 on: January 31, 2022, 11:28:52 am »

This issue is caused by a Genero-Mobile feature: parallel dialogs. START DIALOG D, TERMINATE DIALOG D where D is the name of a callable dialog (aka procedural dialog). A callable dialog defining a MENU can not be used as a sub dialog of a multiple dialog. The usage is limited to parallel dialogs.

The compiler can not detect this issue. The runtime should raise an error.
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines