How would i detect which character has just been typed in a text area?
Character In Text Area
BlitzPlus Forums/BlitzPlus Programming/Character In Text Area Thanks, but i need to record the keystroke in the text area as they type it so that for example if they typed e as they pressed it, it opened a notify box. I tried KeyHit() but that doesnt work when youre in a textarea.
I meant you could Monitor the TextAreaText like this:
This will notify the user when they enter a lower or uppercase letter e.
DeskW = ClientWidth(Desktop()) DeskH = ClientHeight(Desktop()) Parent = CreateWindow("TextArea Text Monitor Example", DeskW/2-320, DeskH/2-240, 640, 480, 0, 1) TextBox = CreateTextArea(1, 20, 632, 434, Parent, 1) TextMon = CreateTimer(100) ; 100ms AreaText$ = "" ; Area Text Repeat Select WaitEvent() Case $803 End Case $4001 ; Tick Select EventSource() Case TextMon tmp$ = TextAreaText$(TextBox) ; Grab Text If tmp$ <> AreaText$ Then ; User has entered a character tmp2$ = Right(tmp$, Len(tmp$) - Len(AreaText$)) ; Isolate new from old entry If Instr(Lower(tmp2$), "e", 1) Then Notify "You entered an 'e'" AreaText$ = tmp$ EndIf End Select End Select Forever
This will notify the user when they enter a lower or uppercase letter e.
Thanks for that. It's perfect!