Detect a keypress in an editor gadget

Just starting out? Need help? Post your questions and find answers here.
coco2
Enthusiast
Enthusiast
Posts: 461
Joined: Mon Nov 25, 2013 5:38 am
Location: Australia

Detect a keypress in an editor gadget

Post 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.
firace
Addict
Addict
Posts: 946
Joined: Wed Nov 09, 2011 8:58 am

Re: Detect a keypress in an editor gadget

Post 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 
coco2
Enthusiast
Enthusiast
Posts: 461
Joined: Mon Nov 25, 2013 5:38 am
Location: Australia

Re: Detect a keypress in an editor gadget

Post by coco2 »

Thanks firace

Code: Select all

EventType() = #PB_EventType_Change
Post Reply