GUI2 custom dialog questions
Moderator: Forum Moderators
-
- Posts: 462
- Joined: June 8th, 2006, 3:25 am
GUI2 custom dialog questions
I'm working on using wesnoth.show_dialog to create a custom dialog in 1.9.0, and I've run into a stumbling block. I need to color the text in a label widget. Using the old dialog, I just applied Pango to the string, but the label doesn't process the markup by default. As far as I can tell, it should be possible to override the behavior of the widget to do one of a) processing the markup or b) just using a manually defined color by using wesnoth.set_dialog_canvas.
The documentation in the wiki is, however, somewhat sparse, and I haven't been able to figure out the right set of arguments to pass to the function. I know what the path to the widget is, and I've figured out that the only valid values for the canvas index are 1 and 2, but I can't figure out what to put in the WML table to make it work. So far, everything I've tried results in no visible change if the canvas index is 2, and making the text invisible (I guess it disables the widget?) if the canvas index is 1.
The documentation in the wiki is, however, somewhat sparse, and I haven't been able to figure out the right set of arguments to pass to the function. I know what the path to the widget is, and I've figured out that the only valid values for the canvas index are 1 and 2, but I can't figure out what to put in the WML table to make it work. So far, everything I've tried results in no visible change if the canvas index is 2, and making the text invisible (I guess it disables the widget?) if the canvas index is 1.
Last edited by Exasperation on April 30th, 2011, 10:16 pm, edited 1 time in total.
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: colored label widgets in custom dialogs
(no answers in this post)
1. Whenever I pass an apparently wrong table describing the dialog, wesnoth 1.9.0+svn freezes.
2. Could we get a or some much more simpler examples than the one in the wiki (which is almost the same like the one from the testscenario), to show the relation between graphical appearance and the table ?
3. simple definition of "widget" ? I've already looked it up at wikipedia.
1. Whenever I pass an apparently wrong table describing the dialog, wesnoth 1.9.0+svn freezes.
2. Could we get a or some much more simpler examples than the one in the wiki (which is almost the same like the one from the testscenario), to show the relation between graphical appearance and the table ?
3. simple definition of "widget" ? I've already looked it up at wikipedia.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Re: colored label widgets in custom dialogs
http://en.wikipedia.org/wiki/GUI_widget
For the other questions, you might want to check with Mordante a.k.a. SkeletonCrew.
I'm not really an expert on the new features.
For the other questions, you might want to check with Mordante a.k.a. SkeletonCrew.
I'm not really an expert on the new features.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
-
- Posts: 462
- Joined: June 8th, 2006, 3:25 am
Re: colored label widgets in custom dialogs
I got b) working, so no need to answer my question.
Re: colored label widgets in custom dialogs
Yes, that's an unfortunate feature of the GUI engine. Assertions were used, not to check the internal consistency of data, but to validate external values. So, expect the engine to constantly crash while trying to write the correct WML containers. I have already replaced the assertions I experienced, but I'm sure there are still lots of them. So please report them and I will fix them.Anonymissimus wrote:1. Whenever I pass an apparently wrong table describing the dialog, wesnoth 1.9.0+svn freezes.
Note that it isn't specially difficult to fix them. So you may also try to do it on your side too, as it will considerably ease your WML development. See the following patches for instances of how to convert failed assertions into proper errors.
http://svn.gna.org/viewcvs/wesnoth/trun ... uilder.cpp
http://svn.gna.org/viewcvs/wesnoth/trun ... erator.cpp
Do you have some examples in mind?Anonymissimus wrote:2. Could we get a or some much more simpler examples than the one in the wiki (which is almost the same like the one from the testscenario), to show the relation between graphical appearance and the table ?
As far as I'm concerned, I learned the syntax by reading the .cfg files in data/gui/default.
I don't understand your question. If you looked it up in Wikipedia, you already know that it means "window gadget". (I didn't check, I hope that's the definition Wikipedia gives.) Is there something missing? Or do you mean that the Wesnoth documentation should remind this definition too?Anonymissimus wrote:3. simple definition of "widget" ? I've already looked it up at wikipedia.
Ouch, I didn't expect one to have to go as far as overwriting the canvas to simply get Pango markup inside a label. I somehow hope there exists a simpler way.Exasperation wrote:I got b) working, so no need to answer my question.
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: colored label widgets in custom dialogs
@Exasperation
Could you please post whatever you got working ?
For anyone checking this out, expect crashes and such since the engine gui code is (not yet) very stable. And when the engine seems to freeze when it should show the dialog, press enter or esc on the keyboard so you don't need to shut down wesnoth.
Could you please post whatever you got working ?
For anyone checking this out, expect crashes and such since the engine gui code is (not yet) very stable. And when the engine seems to freeze when it should show the dialog, press enter or esc on the keyboard so you don't need to shut down wesnoth.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
-
- Posts: 462
- Joined: June 8th, 2006, 3:25 am
Re: colored label widgets in custom dialogs
Sure. It's in ATBX, so you can get the most recent version off the 1.9.0 add-on server, but the specific function that calls show_dialog is as follows (spoilered for length):
Not sure how much help it's going to be - it's pretty messy (a lot of trial and error involved in getting it working, and I didn't want to risk breaking it by trying to clean it up too much).
Spoiler:
-
- Posts: 462
- Joined: June 8th, 2006, 3:25 am
GUI2 custom dialog questions
So, I got back to work on this, and decided to start by downloading 1.9.5 and updating the era to work with it. My custom dialog now throws the following error (although it still works for the moment): "<Invalid WML found> Window builder: parsing resolution tip with empty 'id' field. Will become mandatory in 1.9.7."
Unfortunately, I can't find (or at least have been unable to recognize) any related parts of the GUI2 documentation. Any ideas?
Unfortunately, I can't find (or at least have been unable to recognize) any related parts of the GUI2 documentation. Any ideas?
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: GUI2 custom dialog questions
Dude -
1. Our lua expert (silene) decided to go away so we're on our own.
2. Thus you may be currently the one who knows most about lua dialog coding (I did shy away from it ever. )
3. mordante can possibly tell you about that error, but you need to ask him in IRC.
1. Our lua expert (silene) decided to go away so we're on our own.
2. Thus you may be currently the one who knows most about lua dialog coding (I did shy away from it ever. )
3. mordante can possibly tell you about that error, but you need to ask him in IRC.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
- Elvish_Hunter
- Posts: 1576
- Joined: September 4th, 2009, 2:39 pm
- Location: Lintanir Forest...
Re: GUI2 custom dialog questions
The very same thing applies for me. Perhaps we need a tutorial page that explains in a simple way how to make dialogs with Lua. For example, on Python I'm currently using Tkinter with ttk; and I was able to get started because I found this tutorial that teached me how to think in Tkinter (although I used the Italian translation).Anonymissimus wrote:2. Thus you may be currently the one who knows most about lua dialog coding (I did shy away from it ever. )
Following this example, a wiki page explaining dialogs with Lua should start with some simple dialogs (like placing a button, a text entry, and how to position them), and end with something more complex. Anyone up for the challenge?
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
-
- Posts: 462
- Joined: June 8th, 2006, 3:25 am
Re: GUI2 custom dialog questions
Victory is mine! In addition to a [grid] child, the dialog box table now also requires a [tooltip] child and a [helptip] child. I'm off to edit the relevant WML reference entry.