keydown event

BlitzPlus Forums/BlitzPlus Programming/keydown event

Nathan(Posted 2003) [#1]
I´m experimenting a little with the BlitzPlus GUI possibilities and I encounter the following problem.

I have some textarea gadgets that highlight a specific letter in a specific color.
This is no problem when I use the keydown event ($101).
However when the cursor enters yet another textarea gadget (for textentry) apparently the keydown event is not triggered anymore.
What am I doing wrong here?

Thanks.


Nathan(Posted 2003) [#2]
For clarity this is the code.

window=CreateWindow("Mouse Tricks",50,50,250,200,0,15)
textfield1=CreateTextArea(25,0,200,20,window)
button1=CreateButton("Ok",GadgetWidth(window)/2-15,GadgetHeight(window)/2-10,30,20,window,1)
textfield2=CreateTextArea(100,50,20,20,window)
textfield3=CreateTextArea(125,50,20,20,window)
textfield4=CreateTextArea(150,50,20,20,window)

;initialisatie van de textfields
SetTextAreaText textfield2,"A"
SetTextAreaText textfield3,"B"
SetTextAreaText textfield4,"C"
SetTextAreaColor textfield4,255,0,0

While WaitEvent()
	Select EventID()
	Case $101
		If EventData()=30 Then ;letter A
			SetTextAreaColor textfield2,0,0,255
		End If
		If EventData()=48 Then ;letter B
			SetTextAreaColor textfield3,0,0,255
		End If
		If EventData()=46 Then ;letter C
			SetTextAreaColor textfield4,0,0,255
		End If
	Case $401
		If EventSource()=button1 Then ;indien button1 ingedrukt wordt
			;kleur de geselecteerde tekst in textfield1 rood
			FormatTextAreaText textfield1,255,0,0,0,TextAreaCursor(textfield1),TextAreaSelLen(textfield1)
		End If
		If EventSource()=textfield1 Then
		End If
	Case $803 ;EventID window close.
		End
	End Select
Wend



Eikon(Posted 2003) [#3]
Disregard this gibberish


Nathan(Posted 2003) [#4]
I´m not sure how your hint would fit into my code. I recently started with Blitz so I´m rather new to this.

By the way scary website you have.

Thanks.


Eikon(Posted 2003) [#5]
Lol, thanks :)

Interesting code, that looks like a bug.


Nathan(Posted 2003) [#6]
Ok, thanks I'll take this to the BlitzPlus Bug Reports.


CS_TBL(Posted 2003) [#7]
already tried ActivateGadget on the gadget that houses your keypresses ?


SJT(Posted 2003) [#8]
I found event loop problems and solved it by assigning variables for EventData(), EventSource(), EventID() and then using the variables.
B+ forgot the valve of the Eventxxxx() functions once I started using a nested select structure.
I don't know if thats part of your problem though?

Steve

XP


Nathan(Posted 2003) [#9]
@CS_TBL. Just tried ActivateGadget but infortunately doesn´t work.

@SJT. I assigned all the Eventxxx to variables. But the effect described above stays the same.

Anymore ideas ,please.


julianbury(Posted 2003) [#10]
You can only get the full keydown info from non text gadgets. I struggled for ages to find ways round. In the end I found the best way is to keep swapping between your text gadgets and the window gadget. That implies that you must keep track of where the cursor belongs and bear in mind those few keypesses that are detected in the text environment.

In the meantime, add your plea to all the others for this defficiency to be rectified.


Nathan(Posted 2003) [#11]
In the meantime, add your plea to all the others for this defficiency to be rectified.


I will.
Thanks for the workaround.