Textfield not registering Return

BlitzPlus Forums/BlitzPlus Programming/Textfield not registering Return

DrDerekDoctors(Posted 2006) [#1]
I've posted this in the bugs forum, but seeing as that gets about as many visitors as most old people's homes once the family have dumped their elders there I thought I'd try it here, too.

pseudo_group_window = CreateWindow("Select Name For Group",ClientWidth(Desktop())/2,ClientHeight(Desktop())/2,256,128,0,1)
pseudo_group_textfield = CreateTextField (16,16,ClientWidth(pseudo_group_window)-32,16,pseudo_group_window)
	
SetGadgetText (pseudo_group_textfield,"hello")

Repeat

	id=WaitEvent()

	DebugLog "Event = $"+Right$(Hex$(id),4) + "   "+EventSource() + "   "+EventData()


	Select id


		Case EVENT_GADGET
			If EventSource() = pseudo_group_textfield
				SetGadgetText (pseudo_group_label,EventData())
				If EventData() = 13
					Stop
					Exit
				EndIf
			EndIf

	End Select

Forever



Basically pressing enter in the textfield generates an event of value $104 (which doesn't exist) and the EventSource and EventData are both 0. Wuh?


Tiger(Posted 2006) [#2]
This is a problem, it work before but not now.
I hear that someone used a button with the style set to 4.
But I don't know how it work if you have more then one textfield that need's this function.
Maybe the button and textfield needs to be in the same group??


Regular K(Posted 2006) [#3]
Textfield isnt meant to have multiple lines, so that problem it. It just ignores them.


Beaker(Posted 2006) [#4]
If you look at this example:
http://www.blitzbasic.com/codearcs/codearcs.php?code=1040
..you will see that you can get the ENTER event (13) from the URLgo button. Not ideal, but it works, and BlitzMax MaxGUI works like this as well.


Rck(Posted 2006) [#5]
Also try on a textarea but just make it the height of a field, and immed. grab the enter and clear the area


Tiger(Posted 2006) [#6]
@Beaker:
Your code don't catch Enter anymore after the latest update of Blitz+.


Beaker(Posted 2006) [#7]
So it doesn't. Bummer. :(


Beaker(Posted 2006) [#8]
Fixed by changing the button style to 4:
URLgo = CreateButton ("GO!",620,10,60,20,panel,4)

Checkout the online help here:
http://www.blitzbasic.com/bpdocs/command.php?name=CreateButton&ref=gui_cat


DrDerekDoctors(Posted 2006) [#9]
Ta' muchly, I'll look into these solutions. However is it just me, or is that really kinda' @#!* that it's broken? I know that BP is lacking in many features but actually breaking existing ones is a plain crappy move on Mark's part.


Beaker(Posted 2006) [#10]
It's not broken, it was changed. I think it is an improvement. Also, I think the change was made by Skid, not Mark.


DrDerekDoctors(Posted 2006) [#11]
How is it an improvement? If something works just peachy, and then stops working in the way that everybody expected it to work, then that's broken.

Oh sure, we might have a button as well now, but that means cramming it into an existing layout which might have been carefully designed and won't easily accomodate such a thing (not a problem in my case).

I don't mind extended functionality at all, I just mind people changing the goalposts.


Tiger(Posted 2006) [#12]
In my case I didn't use any buttons to my textfield from the begining, so I just made a 'emty' on like this,
EnterButton=CreateButton("",0,0,0,0,Parent,4)


So I don't need to change my layout.