I am refining an operator interface and continue to find odd behaviours. Something which has puzzled me for a while is the apparent slow … and varied … responsiveness of the interface.
As an example, the application can take several seconds to execute some minimal code which simply recognises that a text field has been left empty.
I use recognition of leaving the field within DisplayIsOpen() to execute an expression:
The code executed when the field is empty is a trivial if statement producing the displayed message “A job number is required”, and a function which initialises various tags.
As mentioned … this can take seconds, and is expected to be almost instantaneous. Is this possibly a characteristic of the development environment … or am I trying to do something which isn’t well supported? The process looks pretty straight forward to me … but the time taken is extremely variable and often several seconds … which seems unreasonable.
Any advice appreciated.
Thank you for reaching out to us.
Could you send us the .tproj file, so we can run some tests to determine what is causing this delay?
I won’t send the project file at this time, as I am aware my project is a relatively unusual application which is relying on some non-typical methods. I am continuing to look for alternative approaches, but I am not helped by my lack of familiarity with .NET capabilities.
The core of the problems I am experiencing follow from my requirement to have the application primarily keyboard driven. That is, I need to reliably and quickly detect keyboard focus gain/loss and text box/grid cell value changes driven by TAB and arrow key movements between text boxes and grid cells.
This just doesn’t seem to be an approach that fits well within the TATSOFT environment, but I am quite confident this is mainly a reflection of my lack of understanding.
What I am mainly finding is that I have been unable to enforce synchronous execution between field/cell transitions within a display … for example via:
AddHandler “TTextBox control”.IsKeyboardFocusWithinChanged, AddressOf
and Tasks or Expressions triggered by detected focus changes. This really puzzles me, as I am very familiar working in typically asynchronous environments and with applying methods to enable synchronisation via semaphores, flags etc. So far my attempts within this application have repeatedly failed to provide 100% consistent behaviour. As a result, I feel I am missing some key understanding of the TATSOFT environment … and I continue to investigate.
If you have any general advice relating to keyboard driven applications or any examples that you think may assist me, they would be appreciated.
A suggestion for extension of Dynamics->Action on TextBox (and other objects) would be to include actions such as receive/lose keyboard focus if possible. At the moment only Mouse actions are available.
Thank you for providing more details about the situation.
Your application requirement of being keyboard driven should not be a problem with FactoryStudio, our objects have many events that can be triggered by keyboard actions. Please find below a code example using the IsKeyboardFocusWithitnChanged
Public Sub DisplayIsOpen()
Dim box As TTextBox = TryCast(Me.CurrentDisplay.GetControl("box"), TTextBox)
AddHandler box.IsKeyboardFocusWithinChanged, AddressOf handler
Public Sub handler(ByVal sender As Object, ByVal e As DependencyPropertyChangedEventArgs)
Please let us know if you have any other questions.
Thanks for the response.
I have been attempting to use IsKeyboardFocusWithinChanged for some time, but with limitted success. Recently I found that although I can reliably detect when the cursor has left a text box through use of the TAB key … the associated tag value has not been updated with the typed entry … so not very useful for my application. I have raised this in a forum item and asked for any suggestions.
Sequence of keyboard focus events and tag setting - Scripts, SQL, .NET Framework - Tatsoft