I am relatively new to Clarion (using it for about 9 months) and I am trying to figure out how to use an entry control (for “notes”), but with multiple lines, like a text control.
I need to use the entry (vs the text) because I need the IMM property for updating another field while typing in the entry field (for a character counter).
I was using the text control, but it would only update my character counter when I accepted the changes of the “notes” field. I need the count to be realtime.
Any tips would be greatly appreciated. Thanks in advance.
Not a direct answer to your question, but you could use TIMER(25) and EVENT:Timer to update the character counter 4 times a second.
This works:
PROGRAM
MAP
END
LOC:TEXT STRING(1000)
Window WINDOW('Caption'),AT(,,215,146),GRAY,FONT('Segoe UI',9),TIMER(25)
TEXT,AT(9,8,175,81),USE(LOC:TEXT)
STRING('String1'),AT(11,94,177),USE(?STRING1)
STRING('String2'),AT(12,108,182),USE(?STRING2)
BUTTON('&OK'),AT(9,126,41,14),USE(?OkButton),STD(STD:Close)
END
CODE
OPEN(Window)
ACCEPT
CASE EVENT()
OF EVENT:Timer
?STRING1{PROP:Text} = 'ScreenText:'&LEN(?LOC:TEXT{PROP:ScreenText})
UPDATE(?LOC:TEXT)
?STRING2{PROP:Text} = 'LOC:Text: '&LEN(CLIP(LOC:TEXT))
END
END
1 Like
SubClass the Text control and watch for the WM_Char messages messages. See PROP:WndProc. GetWindowTextLength() will give you the Length using the control Handle passed to the sub class proc. Use SetWindowText to put the Length into a String control right in the SubClass procedure.
3 Likes