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: Action Default Sytax for ON KEY (CONTROL-F)  (Read 4484 times)
Jonathan B.
Posts: 3

« on: June 20, 2019, 01:20:09 am »

Hello,  New to Genero and 4GL.

Quick question.  Could not find answer via search

Trying to add text and comments to existing ON KEY structured code via the ACTION DEFAULTS section of the .per file
Been working well except in one section they are using Control-LETTER key combinations.

So the .4gl code had     ON KEY (CONTROL-F)

I am trying to map it in ACTION DEFAULTS like this


As far as I can Tell the Action "Name" second field needs to match the ON KEY label however the compiler is giving me a syntax error

error:(-6803) A grammatical error has been found at '-', expecting '('.

Any help appreciated on how to get the Control-F in action name to match to the On KEY

Sebastien F.
Four Js
Posts: 487

« Reply #1 on: June 20, 2019, 10:29:29 am »

Hello and welcome to Genero!

The ACTION DEFAULTS section of form files has a syntax for regular action identifiers (like accept, cancel, print, ...).
You cannot define action default attributes for an action named "control-f" there.

You can however use a .4ad file with XML:

  <ActionDefault name="control-f" text="my text" contextMenu="no"/>

Assuming that you want to decorate ON KEY(CONTROL-F) all over the application with the same action defaults, you can put that in a global .4ad file.

If the decoration must be form-specific, you can setup a form initializer to patch the AUI definition of the form and add your ActionDefault node at runtime.

For more details about action configuration:

About ON KEY action names:

And about form initializers and AUI tree manipulation at runtime:

Sebastien F.
Four Js
Posts: 487

« Reply #2 on: June 20, 2019, 11:55:12 am »

By the way since you are new to Genero:

One of the first thing you should consider is the locale (character set) you want to use in your sources, at runtime and in your database.

This is the first things that I always recommend to check, before mixing character set configurations here and there, and wonder after a few months in production that you have crap in your database.

If you start from zero and you want to support multiple languages in your application, using UTF-8 is a good idea.

Then ideally, with UTF-8, use FGL_LENGTH_SEMANTICS=CHAR, if the database supports properly character length semantics.

Contact our support if you need help to figure out.

Jonathan B.
Posts: 3

« Reply #3 on: June 20, 2019, 02:54:50 pm »

Thanks for the responses,  I will work on a solution for us. 
Reuben B.
Four Js
Posts: 949

« Reply #4 on: June 21, 2019, 07:17:33 am »

What you should also consider is what happens if you run your application on a mobile device.  How do you press Control-F on a Mobile Device? 

To future proof your code, you would look to replace ON KEY, COMMAND KEY etc with an ON ACTION statement  e.g.

  1. ON ACTION control_f
and then you can reference the action, either in the .per like you were originally trying

  1. ACTION control_f (TEXT="Text", COMMENT="CTRL-F - Comment", ACCELERATOR=control-f, DEFAULTVIEW=NO)

or globally in a .4ad like Seb suggested

  1. <ActionDefault name="control_f" text="my text" contextMenu="no" defaultView="no"/>

If you wanted no buttons and action only triggerable by pressing Control-F then you would leave defaultView = no, but if you wanted somewhere for the user to press to trigger the action then you would change defaultView to auto or yes.  (no compilation required if changing .4ad)

Early adopters of Genero in the early-mid 2000s tended to be more aggressive with their code transformations and were quite prepared to search and replace the likes of  ON KEY, COMMAND KEY etc with ON ACTION and have benefitted as a result. 


Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of
Contributor to
Pages: [1]
  Reply  |  Print  
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines