Title: Compile help Post by: Huy H. on December 12, 2019, 11:32:32 pm What am I doing wrong here? It seems I cannot compile when an ACTION follows by both INFIELD and ATTRIBUTES.
Code
http://genero.versaterm.com/BDL/3.20/#fgl-topics/c_fgl_dialog_ON_ACTION.html Title: Re: Compile help Post by: Rene S. on December 13, 2019, 09:19:17 am Hello, this is a compiler bug/weakness.
When introducing ON ACTION action-name ATTRIBUTES() we excluded ON ACTION action-name iNFIELD field-name ATTRIBUTES(). Why? The semantics was not clear. What happens in this example: Code What happens if the focus switches from field1 to field2? The answer should be: DEFAULTVIEW = auto, TEXT = "foo", no accelerator. In 3.00.05 we have fixed: https://agile.strasbourg.4js.com/jira/browse/FGL-4140 (https://agile.strasbourg.4js.com/jira/browse/FGL-4140) ON ACTION ATTRIBUTES must belong to the sub-dialog. That's a similar situation: Code
I've created this new bug: https://agile.strasbourg.4js.com/jira/browse/FGL-5311 (https://agile.strasbourg.4js.com/jira/browse/FGL-5311) ui: ON ACTION ATTRIBUTES should be possible for actions with INFIELD clause. Out of scope: My instinct: the same action should have in any context the same attributes. It's kind of annoying to repeat the attributes when using an action more than once. For that reason: use action defaults, avoid action attributes in the 4GL code. Use the ATTRIBUTES clause only for actions appearing no where else in your project. Title: Re: Compile help Post by: Rene S. on December 13, 2019, 09:29:35 am I've overseen this existing bug:
https://agile.strasbourg.4js.com/jira/browse/FGL-4542 (https://agile.strasbourg.4js.com/jira/browse/FGL-4542) ON ACTION .. INFIELD does not allow ATTRIBUTE(S) Anyway, don't expect any activity on this issue. There is no added value compared to regular action defaults - except your are really excepting different attributes in different contexts. Title: Re: Compile help Post by: Reuben B. on December 17, 2019, 04:43:47 am Rene,
Did you consider the case of a one-off action where it is preferred to define all you need to with the ON ACTION, and therefore no need to touch a .4ad or .per. In that case I think ... Code would be preferred to Code
Reuben Title: Re: Compile help Post by: Rene S. on December 17, 2019, 08:29:34 am Hello Reuben,
Yes, I did. OTH: why adding extra code (setActionActive here and there) if on action infield exists? On action infield has been introduced for exactly this reason: simplify the 4gl code. The runtime controls the activation of actions. If (hypothetically) the attribute clause would be supported for an on action infield then we end in the dilemma: the programmer must repeat all attributes for each action with the same name. This is the opposite of simple. Title: Re: Compile help Post by: Huy H. on December 17, 2019, 03:27:52 pm For us, this is sort of a one-of situation. We have our action defaults defined in a 4ad file. In this particular situation, we wanted the attributes of this action to be different than the defaults defined within the 4ad. We've used INFIELD and ATTRIBUTES in the past, it just wasn't clear to us that the two cannot be used together in the code. It's not a big deal really, we've found a work around that we think it's more intuitive to the user: We added a button on the form next to the field (therefore DEFAULTVIEW = YES) and only used the INFIELD in the code.
Like Rene had alluded to, there's other ways that we can do to get to the behavior we desire, just that it wasn't obvious to us why the syntax didn't work. |