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.
[Solved] Button with more text fields
Moderators: CEGUI MVP, CEGUI Team
Re: Button with more text fields
Read the API docu - you can access child windows via getChild(...)
CrazyEddie: "I don't like GUIs"
Re: Button with more text fields
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.
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.
Re: Button with more text fields
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.
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.
Re: Button with more text fields
I managed to do it through <child> tag in my .looknfeel file.
You can't access what does not exist. <ImagerySection/> and <StateImagery/> do not define new windows to my understanding.
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.
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.
Re: Button with more text fields
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.
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"
Re: Button with more text fields
Yes, by "paste exactly what you are doing" I meant code. We still didn't get any logs.
Re: Button with more text fields
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.
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.
Re: Button with more text fields
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"
Who is online
Users browsing this forum: No registered users and 19 guests