Page 1 of 1

create an Event

Posted: Wed Dec 26, 2007 7:36 am
by shagdawg
I have been going through the API and trying some things for over an hour and searched the forums trying to find an answer to my problem but just can't find much.

Anyhow I have made an edit box and played around with it and the event receiver. But anyhow here is what I am trying to do. I want to mimic the behavior of clicking on the box with a key event.

So for example I start my program I can click on the edit box and start typing in it.
What I want is to start my program and instead of clicking on the box I want to say hit the 'c' key and it will the activate the box so I can start typing in it.

So playing around with the event receiver I can grab the 'c' key event.
When i grab the event for the 'c' key event I want to create a new event within the code to mimic clicking on the edit box which believe I can figure out but what I can not figure out is how to take my new SEvent and throw that into the engine.

Here is an example of what I am trying to figure out

if (event.EventType == EET_KEY_INPUT_EVENT && event.KeyInput.PressedDown && event.KeyInput.Key == KEY_KEY_C)
{
SEvent temp;
temp.xxxx = xxxxx //Fill in the needed info for the new event(should be able to figure this out myself)
return ???.???(temp)
}

So I am looking for what I can call within the engine for the new event.

Posted: Wed Dec 26, 2007 7:56 am
by christianclavet
I'm not sure about this, but you would surely have to check the functions available from the SDK for that object (edit box).

I didnt found a function to set the "focus" on the current release. But there should be a way to do this. One thing is to check the source.

Posted: Wed Dec 26, 2007 5:31 pm
by vitek

Code: Select all

gui::IGUIEnvironment* gui = device->getGUIEnvironment();
//...

gui::IGUIElement* root = gui->getRootGUIElement();
if (root) {
    gui::IGUIElement* box = root->getElementFromId(MY_EDITBOX_ID, true);
    if (box)
        gui->setFocus(box);
}

Posted: Wed Dec 26, 2007 8:30 pm
by shagdawg
Vitek not exactly how I was trying to solve this but I like the solution even better!