[Solved] Button with more text fields

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

Ondra
Just popping in
Just popping in
Posts: 4
Joined: Fri Jan 03, 2014 18:01

[Solved] Button with more text fields

Postby Ondra » Fri Jan 03, 2014 18:05

Hi,
I managed to have more text fields on button in same manner like in this thread: viewtopic.php?t=3902

However I am unable to change text for each label independently. More importantly I don't know how to acces named field from C++ code. For example text1 property.

I want to make button with two (or more) independetn text fields on it with differt colors & fonts possibly.

Thanks a lot.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Button with more text fields

Postby Ident » Fri Jan 03, 2014 22:52

Read the API docu - you can access child windows via getChild(...)
CrazyEddie: "I don't like GUIs"

Ondra
Just popping in
Just popping in
Posts: 4
Joined: Fri Jan 03, 2014 18:01

Re: Button with more text fields

Postby Ondra » Mon Jan 06, 2014 08:21

And does even child window exists for this?

I have all defined only in .looknfeel file. Isn't <stateimagery/> section only defining how is the same object rendered more times? In that case it will be impossible to change both text independently.

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Button with more text fields

Postby Kulik » Mon Jan 06, 2014 10:19

Hi,

first of all, read the huge red text... And do as it says please. It tells us many important details, especially version of CEGUI you are using.

second of all, you want help from us. We could go to the thread, grok it all and somehow figure out what exactly you are trying to do. That is time-consuming and frankly not really worth it for us. If you want help, PASTE HERE EXACTLY what you are doing. This is really important! If you make it easier for us to help we are more likely to do so.

third of all, you likely have property definitions in the looknfeel, why not just use those? see setProperty and getProperty methods.

Ondra
Just popping in
Just popping in
Posts: 4
Joined: Fri Jan 03, 2014 18:01

Re: Button with more text fields

Postby Ondra » Mon Jan 13, 2014 11:50

I managed to do it through <child> tag in my .looknfeel file.

you can access child windows via getChild(...)

You can't access what does not exist. <ImagerySection/> and <StateImagery/> do not define new windows to my understanding.

PASTE HERE EXACTLY what you are doing

I wanted button with more different labels on it (I misspelled it for textfields, but it is probably not so much different). I don't know how much more specific I could have been.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Button with more text fields

Postby Ident » Mon Jan 13, 2014 17:03

Sorry we don't know what version you use, or what exactly you tried so far, so we couldn't and still can't really help you (still not as much info given as you could/should). If you had posted your LNF snippet, for example in shape of a pastebin link this would be much easier and that's the reason i replied with a wrong response: I didn't know what you were trying to do. You can't expect me to take 10 minutes of my time to figure out what you could possibly be trying.

But: In the latest release I would do it by adding a number of Generic/Label windows to a parent Image window (one window per independent text"field" i would want to use). If you add TextArea's to a widget such as described in your referenced thread, you can edit the displayed text via a defined Property or PropertyDefinition in your LNF xml. This can be overwritten in C++ using setProperty(...), like all other properties. For a Generic/Label child window you would just use setText(...) on the specific window that you can get with getChild(...).

I recommend adding Generic/Label child windows for general simplicity and easier positioning and access. Adding a child in LNF xml is also a completely valid approach and has about the same effect - it automatically adds a window of defined type to the parent. Again I would use a Generic/Label for that purpose because it only renders text and nothing else (minimum setup). Whatever the best solution is depends on your type of problem you are trying to solve.
CrazyEddie: "I don't like GUIs"

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Button with more text fields

Postby Kulik » Mon Jan 13, 2014 17:30

Yes, by "paste exactly what you are doing" I meant code. We still didn't get any logs.

Ondra
Just popping in
Just popping in
Posts: 4
Joined: Fri Jan 03, 2014 18:01

Re: Button with more text fields

Postby Ondra » Tue Jan 14, 2014 08:50

I solved it already and you possibly can close this thread.

Ident: The solution with defined property was what I was aiming to at beginning but it was not working. I made it through child definition windows in lnf file in similar manner that is described in auto windows tutorial: http://cegui.org.uk/wiki/Introduction_To_Auto_Windows

Anyway thanks a lot for help and your time.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Button with more text fields

Postby Ident » Tue Jan 14, 2014 16:20

Ondra wrote:I solved it already and you possibly can close this thread.

Ident: The solution with defined property was what I was aiming to at beginning but it was not working. I made it through child definition windows in lnf file in similar manner that is described in auto windows tutorial: http://cegui.org.uk/wiki/Introduction_To_Auto_Windows

Anyway thanks a lot for help and your time.


PropertyLinkDefinition in that case is what you need to be able to use setProperty(...) later. If you had provided as with your LNF snippet we could have helped you better.
No problem.
CrazyEddie: "I don't like GUIs"


Return to “Help”

Who is online

Users browsing this forum: No registered users and 19 guests