Dyalog / ewc-client

Other
1 stars 4 forks source link

Events on key presses and WG don't reflect latest value #264

Open cursork opened 1 month ago

cursork commented 1 month ago

I faced an issue where I wanted to monitor the state of a text input. This is my eWC code:

'F1.SERIES'eWC'Edit' ''(13 10)(23 200)('FieldType' 'Char')('Event' 'KeyPress' 'CBTtt')

This is similar code in ⎕WC:

'F.T'⎕WC'Edit' '' (10 10) (30 200)('FieldType' 'Char')('Event' 'KeyPress' 'Foo')

In both cases, the call back doesn't do anything but print the value received by 'F1.SERIES'eWG'Value' or 'F.T'⎕WG'Value'

If I type 'asd' then move focus away from the text input, then return and enter 'fgh', I get these outputs:

It seems like the Value is not updated in EWC, until the text input loses focus. Similarly, it's worth noting that ⎕WC is the previous state at the very moment of the KeyPress, rather than the result of applying the change.