maxgui : mouse enter inside a textfield

BlitzMax Forums/BlitzMax Beginners Area/maxgui : mouse enter inside a textfield

hub(Posted 2006) [#1]
hi !
how to detect that the mouse is inside a textfield gadget ? Could i use EVENT_MOUSEENTER or EVENT_MOUSEMOVE to check this ?
Thanks !

Local MyWindow:TGadget=CreateWindow("test", 200,200,320,240)

Local MyField:Tgadget = CreateTextField (10,10,200,20, MyWindow)

Repeat

  WaitEvent()

	Print CurrentEvent.ToString()
	
  Select EventID()

	  Case EVENT_WINDOWCLOSE
	     End
	  Case EVENT_MOUSEENTER, EVENT_MOUSEMOVE
	 	Select EventSource()
	
			Case MyField
				Notify "mouse is inside the textfield"
				
		End Select
	
   End Select
Forever



CS_TBL(Posted 2006) [#2]
Those events only work with a canvas (and a panel iirc).


hub(Posted 2006) [#3]
Thanks for the info.
i want display some help info into the statusbar when the user enter text into the textfield (in fact when the gadget got the focus) . How to do that ? Some idea ?


Dreamora(Posted 2006) [#4]
That could be done through the activegadget function.
(might be that the event for gadgetaction is fired on activating as well)


hub(Posted 2006) [#5]
this ok with gadgetaction event. i don't know exactly how to do the same thing with activegadget. Not exatly works as i want too : the user must enter text to see the help (into the status bar).

Strict

Local MyWindow:TGadget=CreateWindow("test", 200,200,320,240)

Local MyField:Tgadget = CreateTextField (10,10,200,20, MyWindow)

ActivateGadget (MyField)

Repeat

  WaitEvent()

	Print CurrentEvent.ToString()
	
  Select EventID()

	  Case EVENT_WINDOWCLOSE
	     End
	
	  Case EVENT_GADGETACTION
	
		Select EventSource()
		
			Case MyField
				SetStatusText MyWindow, "ok"
				
		End Select 
	
   End Select

	If ActiveGadget() = MyField
			SetStatusText MyWindow, "ok2"
	End If
	
Forever



Chris C(Posted 2006) [#6]
max lacks a decent way to detect focus gain and loss, which makes it rather hard to implement anything more that rather basic gui feedback / validation, guess we have to wait for it to mature a bit...