Bug #6901
Event handling - ON ANYWHERE
100%
History
#1 Updated by Marian Edu over 1 year ago
There are two issues with conversion of ON
statement in regards to ANYWHERE
option found during debugging of event handling in FWD:
1. When multiple events are used in a single ON
statement (with OR
) with ANYWHERE
option the option must be applied too all event handlers not just the last one, the fact that ANYWHERE
option is only present at the end is just syntax.
ON 'F1' OF FRAME DEFAULT-FRAME /* this should also be anywhere */ or 'F2' of frame DEFAULT-FRAME anywhere do: message 'frame' skip lastkey view-as alert-box. end.
that gets converted to
EventList list1 = new EventList(); list1.addEvent("F1", defaultFrameFrame /* this should also be anywhere */.asWidget()); list1.addEvent("F2", defaultFrameFrame.asWidget(), true); /* _UIB-CODE-BLOCK-END */ registerTrigger(list1, MultipleTriggersAnywhere.this, new Trigger((Body) () ...
This is actually affecting <large_customer_gui_app>
and also all UI builder generated windows that have code for end-error
and endkey
of window handle with ANYWHERE
option that is basically ignored for ENDKEY
. Pressing ESC
key in <large_customer_gui_app>
is ending the session while it should be ignored - if lastkey is ESC
it returns no-apply.
2. ON
statement with no widgets can only be ANYWHERE
on 'F1' anywhere do: message 'this should not fire' view-as alert-box. end.
gets converted (apparently correct)
registerTrigger(new EventList("F1", true), MultipleTriggersAnywhere.this, new Trigger((Body) () -> { messageBox("this should not fire", ALERT_MESSAGE, BTN_OK, (String) null); }));
The constructors (and addEvent methods) in EventList
allowed registering a trigger for an event with no widgets and anywhere option set to false which is invalid in 4GL, if no widgets are specified the trigger must be ANYWHERE
(global).
Cleaning up did removed those 'invalid' methods/ctors only to discover there were used in converted code as shown before so just marked those as deprecated
and ignored the anywhere
value of input parameter there... it would be nice to avoid using those in conversion.
A simple test in testcases
repo - ui/event-handling/multiple_triggers_anywhere.w
.
#4 Updated by Greg Shah over 1 year ago
- Assignee set to Marian Edu
#5 Updated by Marian Edu over 1 year ago
- Status changed from New to WIP
#6 Updated by Marian Edu over 1 year ago
- Status changed from WIP to Review
- % Done changed from 0 to 100
- File 6901.patch
added
It took me a while to get along understanding xml code in those rules and where/what exactly needs to change... this seems to do the job but please do review and let me know if completely missed the point here :(
Attached the patch for ui statements rule.
#7 Updated by Hynek Cihlar over 1 year ago
Marian Edu wrote:
It took me a while to get along understanding xml code in those rules and where/what exactly needs to change...
I find helpful to turn on rules tracing, this helps to pinpoint the exact place where a particular node or annotation gets touched by the rules. To turn rules tracing on add rules.tracing
Java property to the conversion process. The ast and jast files will then contain additional annotations pointing to the rules locations.
this seems to do the job but please do review and let me know if completely missed the point here :(
Attached the patch for ui statements rule.
Code review. The change looks good.
#8 Updated by Marian Edu over 1 year ago
Hynek Cihlar wrote:
I find helpful to turn on rules tracing, this helps to pinpoint the exact place where a particular node or annotation gets touched by the rules. To turn rules tracing on add
rules.tracing
Java property to the conversion process. The ast and jast files will then contain additional annotations pointing to the rules locations.
Thanks for that Hynek, added this now to my conversion run configuration :)
#9 Updated by Marian Edu over 1 year ago
Marian Edu wrote:
Hynek Cihlar wrote:
I find helpful to turn on rules tracing, this helps to pinpoint the exact place where a particular node or annotation gets touched by the rules. To turn rules tracing on add
rules.tracing
Java property to the conversion process. The ast and jast files will then contain additional annotations pointing to the rules locations.Thanks for that Hynek, added this now to my conversion run configuration :)
Setting debug level to trace(3) seems to also work... it just takes a lot more time so won't used that by default I guess :(
#10 Updated by Greg Shah over 1 year ago
Hynek: Please commit the patch to 3821c.
#11 Updated by Hynek Cihlar over 1 year ago
Greg Shah wrote:
Hynek: Please commit the patch to 3821c.
Patch 6901.patch checked in 3821c revision 14378.
#12 Updated by Greg Shah over 1 year ago
- Status changed from Review to Test