Posting Key Event, it works but...
| Tue, 2005-03-15 09:39 | |
|
Hi all,
I have written a class to post some keyEvents, it has a public method to do it, now I want to post a string of keys, i.e. 01234567891, the length of this string is 11, the first ten of digist are posted successfully but the last digit can't be posted without any error,... I just see 0123456789 on screen, the last digit (1) can't be posted, Why? is there any buffer? here is my public method of KeyPoster ActiveObject : ++++++++++++++++++++ void CKeyEventPoster::StartPostingKeyEvents(TUint aCode, TInt aModifier, TInt aRepeat, TInt aScanCode ) { TWsEvent event; TInt iForegroundWinGroup = iWsSession.GetFocusWindowGroup(); event.SetType(EEventKeyDown); event.SetTimeNow(); event.Key()->iCode = aCode; event.Key()->iModifiers = aModifier; event.Key()->iRepeats = aRepeat; event.Key()->iScanCode = aScanCode; iWsSession.SendEventToWindowGroup(iForegroundWinGroup, event); event.SetType(EEventKey); event.SetTimeNow(); event.Key()->iCode = aCode; event.Key()->iModifiers = aModifier; event.Key()->iRepeats = aRepeat; event.Key()->iScanCode = aScanCode; iWsSession.SendEventToWindowGroup(iForegroundWinGroup, event); event.SetType(EEventKeyUp); event.SetTimeNow(); event.Key()->iCode = aCode; event.Key()->iModifiers = aModifier; event.Key()->iRepeats = aRepeat; event.Key()->iScanCode = aScanCode; iWsSession.SendEventToWindowGroup(iForegroundWinGroup, event); } +++++++++++++++ and I call it in this way: iKeyEventPoster -> StartPostingKeyEvents('0' ,0, 0, EStdKeyNull); iKeyEventPoster -> StartPostingKeyEvents('1' ,0, 0, EStdKeyNull); iKeyEventPoster -> StartPostingKeyEvents('2' ,0, 0, EStdKeyNull); iKeyEventPoster -> StartPostingKeyEvents('3' ,0, 0, EStdKeyNull); iKeyEventPoster -> StartPostingKeyEvents('4' ,0, 0, EStdKeyNull); iKeyEventPoster -> StartPostingKeyEvents('5' ,0, 0, EStdKeyNull); iKeyEventPoster -> StartPostingKeyEvents('6' ,0, 0, EStdKeyNull); iKeyEventPoster -> StartPostingKeyEvents('7' ,0, 0, EStdKeyNull); iKeyEventPoster -> StartPostingKeyEvents('8' ,0, 0, EStdKeyNull); iKeyEventPoster -> StartPostingKeyEvents('9' ,0, 0, EStdKeyNull); iKeyEventPoster -> StartPostingKeyEvents('1' ,0, 0, EStdKeyNull); ++++++++++++++++++++ the red line doesn't work,... Why? |
|






Forum posts: 67
before and after of keyPoseting event replace of in ConstructL and Destructor,
Now the problem solved,
Tnx
Forum posts: 34
For quality Symbian idling, join #symbian at irc.freenode.net
Forum posts: 47
this works fine:
Task.SendKey(backKeyEvent);
no flushing needed, nor could i find a way to flush if needed in api
this did nothing:
ws.SimulateKeyEvent(backKeyEvent);
until i corrected it like this:
ws.SimulateKeyEvent(backKeyEvent);
ws.Flush();
There is also an autoflush function that might work, just found it...
TBool SetAutoFlush(TBool aState);
Sets a session's auto-flush state.
If auto-flush is set to ETrue, the window server buffer is flushed immediately anything is put into it, instead of waiting until it becomes full. This setting is normally used only in a debugging environment.
If the auto-flush state is EFalse, the window server buffer is flushed normally.
grant it, i was sending several keys mind you!
also, ws.SimulateKeyEvent states in api's that it is only for testing purposes only. I was hesitent to use it, as it...
A. sends keys anywhere and everywhere, could prove disastrous
B. is unreliable because of A
C. ?May? impede code signing because it is for "testing purposes" only?
Jay Glass
Phoenix, AZ. USA
http://IChiBanComputers.Com