Is there a way to count key pressed during user digitation?

Author: carlospontes@gmail.com (Carlos Pontes)

Hello, everyone! This is my first post on the forum. Sorry if the question is a "beginner". The situation is: I have a form where the user can input a number of characters and Uniface, when user is typing, should display the number of remaining characters available. How could I implement this code? Regards, Pontes

8 Comments

  1. Hi Pontes, are you really using uniface 7 ?? I used uniface 8401 for the example because it is on my PC, but you can do similar things in Uniface 7 as well. Ok, there is a way to get something similar abusing the start modification trigger which in fact will be fired only once per visitin a field whenever the user starts a modification. This will invoke a leave field get back to the field so the start modification will be fired again. You have to make sure there is a "next field", otherwise you may land in the previous field. And turn off "auto select" if the widget provides this feature. In the start modification trigger you enter the following code: macro "^next_field^prev_field^help" the help trigger will us the message based on the length of the field message $length(myfield) in Uniface7, $length is not available so you have to use: length x_field1 message $result


    Author: ulrich-merkel (ulrichmerkel@web.de)
  2. Please be advised that this does only work in Unifields which are obsolete. The same trick won't work with editboxes. So implementing this will have an impact on a possible upgrade in the future. However, from Uniface 9.6 onwards you can implement something similar with the HTML widget. So if it is only one or two fields and you document your work properly Uli's proposal can be a solution for the time being.


    Author: Theo Neeskens (tneeskens@itblockz.nl)
  3. Sorry Theo, as I stated in my post , I have tested it in 8401 (editboxes) without problems. Looks like your misleading advise comes without checking the facts The activation of SMOD works in editboxes very well. The only thing which works only in unifields is the setting of $char, which we do not use here.


    Author: ulrich-merkel (ulrichmerkel@web.de)
  4. Hi Uli, "Misleading" and "Not checking the facts" are a bit harsh. But in essence you are right. I did not check your solution, I was just speaking from experience with my similar old solution which only worked with editboxes. So your solution may work very well. Please accept my apologies.. (And please be aware that my response was not an attack on you. I respect the efforts you put into the community a lot.) Theo


    Author: Theo Neeskens (tneeskens@itblockz.nl)
  5. Hi Theo, "So your solutiuon may work very well" is a clear repetition of spreading doubts without tests (while building a testset for this costs less than 10 minutes). Your post IS misleading without checking the facts -again- What a strange mixture of an attack inside of an apology. It may be funny, that cool Bart Simpson attitude (but not on forums like this one): "I deeply regret and I will never do it again and I apologise for naming you xyz, you XYZ!!!"


    Author: ulrich-merkel (ulrichmerkel@web.de)
  6. Hi Carlos Pontes, just send an email to ulrichmerkel@web.de with some details about your uniface version. I can then prepare a proof-of-concept component for you where you can see what needs to be done. Think this will be the best support for someone new in unifaceland. Uli


    Author: ulrich-merkel (ulrichmerkel@web.de)
  7. Hi Pontes, it's always the best if you can stay inside the documented functionality of uniface. Kind regards, Uli


    Author: ulrich-merkel (ulrichmerkel@web.de)
  8. Hello! I apologize for the delay in response because I was in work traveling . Unfortunately there wasn't how to implement the solution, because of urgency's client. Anyway thank you for your attention and I hope to learn and, perhaps, be able to contribute to this forum. Regards, Pontes


    Author: Carlos Pontes (carlospontes@gmail.com)