Activategadget()

BlitzMax Forums/MaxGUI Module/Activategadget()

Henri(Posted 2013) [#1]
Hello,

I have red some forum topics about this one, but nothing which really answers my dilemma. What I'm trying to do:

Strict

Import maxgui.drivers

Local win:tgadget = CreateWindow("Main",0,0,200,110,Null,WINDOW_CENTER|WINDOW_TITLEBAR)
Local txt:tgadget = CreateTextField(5,10,180,24,win)
Local button:tgadget = CreateButton("Search",5,40,180,30,win,BUTTON_OK)

Repeat
	WaitEvent()
	Select EventID()
	Case EVENT_WINDOWCLOSE
		End
	Case EVENT_GADGETACTION	
		Select EventSource()
		Case button
			'Enter button was pressed
			SetGadgetText(txt,"")
			ActivateGadget(txt)
		EndSelect
	EndSelect
Forever



Is there easy solution to return focus to textfield after ENTER_KEY has been pressed ?


-Henri


jsp(Posted 2013) [#2]
Hmm, I wondered why this should not work and compiled your code with different MaxGUI versions.
While the code works directly with 1.40 it does work not anymore with version 1.42
You probably found a bug to report...


Brucey(Posted 2013) [#3]
I can confirm it does not work on Win32.
Works as expected on OS X.


col(Posted 2013) [#4]
If I recall this was brought up years ago...

Ahh yes, here

If you want this as your expected behaviour you could go into maxgui.mod/win32maxguiex.bmx, Lines 533 to 540 can be commented out. The link is mentioned in the source too.


Henri(Posted 2013) [#5]
Thank you all,
I followed the solution col pointed and indeed it corrects the behaviour to what one would expect. Default action is counterintuitive in my opinion, but I understand why someone would want this because EVENT_GADGETLOSTFOCUS isn't fired anymore. Anyway, life goes on :-)

-Henri