Page 1 of 1

Detect a keypress in an editor gadget

Posted: Mon Mar 17, 2025 11:20 pm
by coco2
How do you detect a keypress inside an editor? Or how do you detect that the text inside the editor has changed? Preferably something cross platform.

Re: Detect a keypress in an editor gadget

Posted: Mon Mar 17, 2025 11:34 pm
by firace
Example:

Code: Select all


Procedure FillList()
  SetWindowTitle(0, " [" + Len(GetGadgetText(11)) + " ch] ")
EndProcedure


OpenWindow(0, 30, 30, 600, 400, "Demo1", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget)

EditorGadget(11, 2, 2, 555, 355)
BindGadgetEvent(11,@FillList(),#PB_EventType_Change )


Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow 

Re: Detect a keypress in an editor gadget

Posted: Tue Mar 18, 2025 12:26 am
by coco2
Thanks firace

Code: Select all

EventType() = #PB_EventType_Change