Syntax checking a field

BlitzMax Forums/MaxGUI Module/Syntax checking a field

D4NM4N(Posted 2006) [#1]
whats the event handle for detecting if the text in a field has changed? Not just when return has been pressed but as soon as a value has been entered and focus has left the gadget


tonyg(Posted 2006) [#2]
SuperStrict

Local MyWindow:TGadget=CreateWindow("TextField Example", 200,200,320,240)
Local Label0:TGadget=CreateLabel("Pls enter your name:",10,10,100,20,MyWindow)
Local Label1:TGadget=CreateLabel("You have keyed in:",10,40,200,40,MyWindow)

Local MyInput:TGadget=CreateTextField(110,10,180,20,MyWindow)
setgadgettext(myinput,"Hello World")

Repeat
  WaitEvent()
  Select EventID()
  Case EVENT_WINDOWCLOSE
     End
  Case EVENT_GADGETACTION
    SetStatusText(mywindow,"Text changed")
   End Select
Forever



D4NM4N(Posted 2006) [#3]
that only does it for all fields, i want to do it on a per field basis

ie:
select eventsource()
Case fld_to
If EventData() =TEXT_CHANGED Then
'perform syntax checking on this field
EndIf


tonyg(Posted 2006) [#4]
SuperStrict

Local MyWindow:TGadget=CreateWindow("TextField Example", 200,200,320,240)
Local Label0:TGadget=CreateLabel("Pls enter your name:",10,10,100,20,MyWindow)
Local Label1:TGadget=CreateLabel("You have keyed in:",10,40,200,40,MyWindow)

Local MyInput:TGadget=CreateTextField(110,10,180,20,MyWindow)
SetGadgetText(myinput,"Hello World")

Repeat
  WaitEvent()
  Select EventID()
  Case EVENT_WINDOWCLOSE
     End
 Case EVENT_GADGETACTION
	Select EventSource()
		Case myinput
 			SetStatusText(mywindow , "Myinput changed")
	End Select
   End Select
Forever



D4NM4N(Posted 2006) [#5]
Great, thatl do it... damn why didnt i think of that!!
LOL its late

thx


Brucey(Posted 2006) [#6]
The EVENT_GADGETLOSTFOCUS event might be useful too...