Editboxes and Listboxes

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
EDarkness
Just popping in
Just popping in
Posts: 11
Joined: Wed Jul 20, 2005 19:57

Editboxes and Listboxes

Postby EDarkness » Fri Aug 05, 2005 19:05

Hello again, fellas. I'm trying to get Editboxes and Listboxes to work. Can someone give me the basics of how they function and what variables need to be set in order for them to work? I got the editbox to display, but whenever I put focus on it and hit a key the program crashes.

Also, I'm just experimenting with listboxes and I'm wondering if someone can also give me a few tips on how they work and how you define a list of things inside the box. Also, if you want a cursor to follow the key input, is there a way to do it?

Thanks for the help. :D


-EDarkness

User avatar
J_A_X
Quite a regular
Quite a regular
Posts: 72
Joined: Wed Jun 29, 2005 13:18
Contact:

Re: Editboxes and Listboxes

Postby J_A_X » Fri Aug 05, 2005 19:27

You can't really come on the forums and ask us to code your thing for ya. I mean, and editbox isn't really complicated, you just create the window with the creatwindow function, you specify in this function the type (editbox in this case) and the name you want to give it. Then when specify a position and size and it should appear on the screen.

If you're getting a problem with the input inject, i suggest looking at the input injection function and do a debug on it. Also, have you ever considered that maybe we have absolutly no clue and what the problem is without anything to base ourselves on other than "I put focus on it and hit a key the program crashes".

Most of these questions are already on the forum. I suggest you search for it.

User avatar
granx
Quite a regular
Quite a regular
Posts: 80
Joined: Fri Apr 29, 2005 21:58

Re: Editboxes and Listboxes

Postby granx » Fri Aug 05, 2005 19:45

Edarkness,
Are you making your UI in code or with XML?

If you are trying to extend a CEGUI::Window to do something new, there are many many virtual functions you can overload.

User avatar
EDarkness
Just popping in
Just popping in
Posts: 11
Joined: Wed Jul 20, 2005 19:57

Re: Editboxes and Listboxes

Postby EDarkness » Fri Aug 05, 2005 20:15

<sigh> Why is it when someone asks for an explanation of how a particular function works, someone has to say they're trying to get someone to write the code for them? All I want is a list of the variables of a editbox that MUST be set in order for it to function properly. I have the editbox on the screen, so creating it is not a problems. Getting it to do anything is the issue. I can't find any good tutorials for various windows. I think after I get a better understanding of how CEGUI works, I'm going to make a tutorial for each kind of window. That way people will know what they need to do and what variables need to be set in order to use them.

Also, I'm not using a mouse to move around my windows, everything is done by keyboard. I have to manually set the focus on the window after a keypress.

Oh, and I'm doing all of my window setup in code not XML. Not trying to do anything new with it...at least not yet. Mainly, I'm just trying to experiment with the windows as they are and after I learn a bit more about them, I'll work on experimenting. :)


-EDarkness

User avatar
J_A_X
Quite a regular
Quite a regular
Posts: 72
Joined: Wed Jun 29, 2005 13:18
Contact:

Re: Editboxes and Listboxes

Postby J_A_X » Fri Aug 05, 2005 20:33

There are no variables to set beforehand. CEGUI does it for ya, you just create the window and that's it, you got a working editbox. Though, if you want it to display on screen, you have to specify a size and position.

Like I said, this isn't editbox related and we can't do anything about cause you still aren't posting anything to base ourselves on.

oh, and do you know what debug mode is? cause you know, you could just go through it and find what's the problem...

User avatar
EDarkness
Just popping in
Just popping in
Posts: 11
Joined: Wed Jul 20, 2005 19:57

Re: Editboxes and Listboxes

Postby EDarkness » Fri Aug 05, 2005 20:52

Why go through the debug trouble when I don't even know what I'm looking for. I wanted to know a bit more about the editbox itself before I went that route. I simply don't know enough about CEGUI and how it sets up it's windows. As I've said many times there aren't enough good tutorials to help people along.

That said, I don't want anyone to help me with my error, all I want is more information about editboxes in general. Since I am not using a mouse to select windows, I think how I'm setting the focus of the window may be the problem. That said, I just need more information about editboxes and listboxes. I don't find that unreasonable.


-EDarkness

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Re: Editboxes and Listboxes

Postby lindquist » Fri Aug 05, 2005 21:21

An editbox is very easy to setup, but expects proper keyboard event injection.

To create on you could do:

Code: Select all

Window* sheet = System::getSingleton().getGUISheet();
Editbox* eb = WindowManager::getSingleton().createWindow("TaharezLook/Editbox","myEditbox");
sheet->addChildWindow(eb);
eb->setPosition(Point(.2,.25));
eb->setSize(Size(.6,.5));


once focus reaches 'eb' it's ready to take keyboard input.

the thing that you need to do is to use

Code: Select all

System::injectChar
to inject the character code of the key that is pressed. This is what reaches the textstring in Editbox.



As to a listbox, it's not too hard either. the listbox itself is created just like the editbox (different window type string of course).

ListboxTextItems is then usually used for content.
You need to create the ListboxItems yourself.
Take a look at the API docs for ListboxTextItem.

There have been many questions about listboxes and some sample code is available in other posts.
Do a search.

For selections to draw anything, remember to set the selection brush and selection colour.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 12 guests