No problem Axolotl, thanks for your patience.
I haven't quite understood your problem yet.
Ok, I refer again to the first part of the program. If you click in the editbox
and enter text, the Debug output of each letter and line count appears immediately. This means: One letter = one output.
Which means there is output in both Windows at the same time.
Code: Select all
;Autor: srod
;http://www.purebasic.fr/english/viewtopic.php?p=173872#p173872
EnableExplicit
Define evMask, i
Procedure Callback(hWnd, uMsg, wParam, lParam)
Protected result
Protected *msgf.MSGFILTER
Protected POINT.POINT
Protected char
Protected lineindex
Protected colindex
Protected col
Protected row
Result = #PB_ProcessPureBasicEvents
Select uMsg
Case #WM_NOTIFY
*msgf=lParam
Select *msgf\NMHDR\code
Case #EN_MSGFILTER
Select *msgf\msg
Case #WM_LBUTTONUP, #WM_KEYUP
GetCaretPos_(@POINT)
char = SendMessage_(GadgetID(1), #EM_CHARFROMPOS, 0, @POINT)
lineindex = SendMessage_(GadgetID(1), #EM_LINEFROMCHAR, char, 0)
colindex = SendMessage_(GadgetID(1), #EM_LINEINDEX, lineindex, 0)
col = char-colindex
row = lineindex + 1
Debug "(" + Str(col) + ", " + Str(row) + ")"
EndSelect
EndSelect
EndSelect
ProcedureReturn Result
EndProcedure
If OpenWindow(0, 0, 0, 250, 200, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
EditorGadget(1, 10, 10, WindowWidth(0)-20, WindowHeight(0)-20, #PB_Editor_WordWrap)
SetActiveGadget(1) ;Focus auf den Editor
evMask = SendMessage_(GadgetID(1), #EM_GETEVENTMASK, 0, 0)
SendMessage_(GadgetID(1), #EM_SETEVENTMASK, 0, evMask | #ENM_KEYEVENTS | #ENM_MOUSEEVENTS )
SetWindowCallback(@Callback())
; ;---------------------------------------------------------
; ;How can I count and see!! the Letters and lines by each i
; ;---------------------------------------------------------
; For i = 0 To 40
; SetGadgetText(1,GetGadgetText(1)+Str(i)+",")
; Debug CountGadgetItems(1)
; Delay(100)
; Next
; ;--------------------------------------------------------
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
End
EndSelect
ForEver
EndIf
If the loop comments are removed, the Loop should act like a simulation of a Keyboard input, but
SetGadgetText(1,GetGadgetText(1)+Str(i)+",") remain invisible until the end of the loop.
I need both!! Each letter within the loop and the output of the Numbers of Letters and lines in the same time.
... same like Keyboard input, that´s all actually.
Best regards Skiller