locked
Keyboard buffer dumps into a focused field. RRS feed

  • Question

  • Hi;

    I have a command button on my form named 'edit'. The command button turns readonly=.F. for all textboxes on the form and then sets focus to the first field which happens to be 'Name'.

    if the user clicks into a readonly field prior to 'edit' and begins to type fast, and then he immediately clicks the edit command button, residue of what he typed goes into the name field.

    Any solutions would be appreciated.

    Thursday, November 21, 2013 8:04 AM

Answers

  • "Set notify off" in the load event of my form class fixed this for all my forms.

    Nothing else works including using set typeahead or _incseek.

    Thank you all for your insights.

    • Marked as answer by Aleniko2 Thursday, November 21, 2013 7:18 PM
    Thursday, November 21, 2013 7:18 PM

All replies

  • In FORM.LOAD type as follows;

    _INCSEEK=0.05

    But whenever you want to  use incremental search in list or combo then you have to set the apropriate value (such as 0.5) to get the typed characters searched in the list.

    To avoid this you can set _incseek=0.05 in gotfocus event of the problamatic textbox (in your case it is 'name') anf in lostfocus you can reset it to its original value (0.5 is the default value.)


    Thursday, November 21, 2013 9:00 AM
    Answerer
  • I don't see why would _incseek help here. Working with textboxes not combos. Anyway - I tried this and it doesn't do anything.

    Thursday, November 21, 2013 10:24 AM
  • 1) Because I think _incseek controls the duration for which keystroke remains in buffer.

    2) Your problem occurs when the user starts typing with speed before clicking edit and when he/she clicks edit the buffered characters are put in the textbox. 

    3) There may be one more reason.  i.e. The wait window that is flashed with the message "The control is read only." Anyhow try to stop it from popping up.

    Belive it or not, but I tried the following on my pc.

    Test with _incseek = 5.

    After this setting your problem will increase. That means if the user types in readonly textbox with a loower speed even though the characters will appear after clicking edit button. 

    Another solution is to use enabled property instead of readonly.
    Thursday, November 21, 2013 11:02 AM
    Answerer
  • You could try the following:

    if CHRSAW() then  && keyboard buffer has content
    	m.ln1 = sys(2001, "TYPEAHEAD") && get buffer max. length
    	SET TYPEAHEAD TO 0 && setting to 0 should clear buffer
    	set TYPEAHEAD to m.ln1 && reset to orginal length
    endif

    Put in your edit button click event before setting the focus.


    The English Bob

    Thursday, November 21, 2013 11:40 AM
    Answerer
  • In addition to the previous answers, I would also change the <<DisabledBackColor>> property of the textboxes, to give some kind of visual reminder to the users
    Thursday, November 21, 2013 2:08 PM
  • "Set notify off" in the load event of my form class fixed this for all my forms.

    Nothing else works including using set typeahead or _incseek.

    Thank you all for your insights.

    • Marked as answer by Aleniko2 Thursday, November 21, 2013 7:18 PM
    Thursday, November 21, 2013 7:18 PM
  • ? SET NOTIFY OFF fixed this behavior?  Sorry I cannot believe.

    CLEAR TYPEAHEAD in Click code should do the job.

    Friday, November 22, 2013 8:13 AM
  • Pavel,

    Like you, I cannot believe SET NOTIFY OFF fixed the problem!

    Clearing the TYPEAHEAD buffer  would fix the problem.

    Set Notify has nothing to do with that buffer.


    The English Bob

    Friday, November 22, 2013 9:36 AM
    Answerer
  • Set notify did fix the problem (Its a fact, so no arguments please).

    The reason (I think) is that the message "The control is read only" comes with some sort of a delay or wait. So when the user types a bunch of letters the delay adds up to a few seconds, and the kb buffer doesn't empty. Setting notify off removed that delay, there is no message and the typeahead empties fast enough to avoid the problem.

    Friday, November 22, 2013 5:14 PM
  • I just tested clear typeahead and believe it or not that does not solve the problem. Set notify off does.

    Friday, November 22, 2013 5:18 PM
  • Yes the delay caused by the screen output could be the reason.
    Friday, November 22, 2013 11:08 PM
  • Good research........Aleniko2 !

    I also drawn your attention to Wait Window in my previous post (Third point).

    Any way thanks  for sharing the solution. 

    Friday, November 29, 2013 9:09 AM
    Answerer