keydown event
BlitzPlus Forums/BlitzPlus Programming/keydown event
| ||
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. |
| ||
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 |
| ||
Disregard this gibberish |
| ||
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. |
| ||
Lol, thanks :) Interesting code, that looks like a bug. |
| ||
Ok, thanks I'll take this to the BlitzPlus Bug Reports. |
| ||
already tried ActivateGadget on the gadget that houses your keypresses ? |
| ||
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 |
| ||
@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. |
| ||
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. |
| ||
In the meantime, add your plea to all the others for this defficiency to be rectified. I will. Thanks for the workaround. |