Posting events and commands
| Wed, 2005-06-15 14:14 | |
|
Hi,
Is there a way to post/send a command or even to my app programmatically? I know I can call HandleCommandL() directly but is there a way to actually post a command to be handled by some UI command/event loop? Basically, I need to send a command to my app as soon as it starts, so any other ideas are welcome as well. Thanx Yaron Tadmor |
|






Forum posts: 56
You may define your own window server event and send it to app (it will be processed async.). Then in HandleWsEventL() you may call HandleCommandL or do whatever you want.
This shows how to send TWsEvent:
TInt activeWGroup = iCoeEnv->WsSession().GetFocusWindowGroup();
//Set event type
event.SetType(EEventUser);
//Get pointer directly to event data (it's size determines by EWsEventDataSize)
TUint8*data = event.EventData() const;
for(TInt i = 0; i < EWsEventDataSize; i++)
{
*data++ = i;
}
iCoeEnv->WsSession().SendEventToWindowGroup(activeWGroup,event); // or maybee SendEventToAllWindowGroups instead
and there is how should we handle it:
{
if(aEvent.Type() == EEventUser)
{
TUint8* data = aEvent.EventData();
for(TInt i = 0; i <EWsEventDataSize; i++)
{
if(*data++ != i) return;
}
//TODO: add your code here
}
}
This is not exactly what you want to do, but hope this helps...
Forum posts: 33
thanx for the reply, I guess this will do.
By the way, isn't a command just another type of event? Meaning, can I send the command I need as a command event?
Yaron
Forum posts: 56
No, there is no such event type. Maybee it's possible to post the command but there is no way to do it using SendEventToWindowGroup(). Maybee there is another way to do it
Regards.