Restored from previous forum. Originally posted by PB.
Code: Select all
; Dingless StringGadget example by PB and Timo -- do whatever you want with it.
; Shows how to avoid the "ding" sound when Esc/Enter is pressed on a StringGadget.
If OpenWindow(0,200,250,450,200,"Test",#PB_Window_SystemMenu)
sg=StringGadget(1,20,20,100,21,"1234567890",#ES_MULTILINE|#ES_AUTOVSCROLL)
SetActiveGadget(1)
Repeat
ev=WaitWindowEvent()
If ev=#PB_Event_Gadget
a$=GetGadgetText(1)
pos=FindString(a$,#CRLF$,1)
If pos0 ; Was Enter pressed on the StringGadget?
SetGadgetText(1,ReplaceString(a$,#CRLF$,"")) ; Yes, so remove CR+LF.
SendMessage_(sg,#EM_SETSEL,pos-1,pos-1) ; Move cursor back to where Enter was pressed.
EndIf
EndIf
Until ev=#PB_Event_CloseWindow
EndIf