create an Event

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
shagdawg
Posts: 9
Joined: Mon Jan 08, 2007 11:36 pm

create an Event

Post 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.
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Post 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.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post 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);
}
shagdawg
Posts: 9
Joined: Mon Jan 08, 2007 11:36 pm

Post by shagdawg »

Vitek not exactly how I was trying to solve this but I like the solution even better!
Post Reply