Custom dialog questions

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
User avatar
ZombieKnight
Posts: 180
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Custom dialog questions

Post by ZombieKnight »

Hi,
1. Any idea how to display long text on multiple lines, rather than with slider? ... and then all the lines align in center?
(like when you type long string into [message])
...

2. How to display it only in top of map, not on top of the right panel?
...

3. How to close the dialog, on >space< or >left_click<?
(Like when closing [message])

Thanks in advance ^^.
I had saurian in profile before, but I've merged my discord profile with forum one...
white_haired_uncle
Posts: 1226
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: Custom dialog questions

Post by white_haired_uncle »

1. Try adding "\n" where you want a line break? If not you may have to use multiple labels. You can use max_width in some places, but I've never figured out how to get that to do anything.

2. You mean it's too big? You can move the location, but (again) I'm not sure about size.

3. You can close with enter or escape, don't know about the others. I know there's a focus member to force the keyboard focus (onto your ok button if you have one and if necessary?) but I've never played with it.
Speak softly, and carry Doombringer.
User avatar
ZombieKnight
Posts: 180
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Custom dialog questions

Post by ZombieKnight »

Thanks, I've got two more questions:

1. How to display my custom dialog only in top of map, not on top of the right panel? (Just like message is shown)

2. How to close the dialog, on >space< or >left_click<? (Like when closing [message])
I had saurian in profile before, but I've merged my discord profile with forum one...
User avatar
Heindal
Posts: 1360
Joined: August 11th, 2011, 9:25 pm
Location: Germany, Karlsruhe
Contact:

Re: Custom dialog questions

Post by Heindal »

You could just use a break in the source code itself. To break them, as far as I know there is no automatism here, but it could be that it exists. My knowledge in this matter might be deprecated. I'd be interested in that too, because it is annoying to manually change text in the way I do.

You can find everything that is possible here with pango:

https://wiki.wesnoth.org/InterfaceActionsWML#Formatting

So you could use:

<small>
Some text which is not so long, but could be longer
Some other text, making a manual break inside the source code.
</small>

You could also work with:

<span gravity="auto">
Text
</span gravity="auto">

Auto will probably not do the trick. Unfortunately you can not use gravity="center", but you could try if they've added this.
The future belongs to those, who believe in the beauty of their dreams.
Developer of: Trapped, Five Fates, Strange Legacy, Epical, UR Epic Era
Dungeonmasters of Wesnoth, Wild Peasants vs Devouring Corpses, Dwarf Dwarfson Dwarvenminer
User avatar
ZombieKnight
Posts: 180
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Custom dialog questions

Post by ZombieKnight »

That was answer to what?
Theres dialog:close() for hiding dialog, but idk how to join it to >space< key
I had saurian in profile before, but I've merged my discord profile with forum one...
User avatar
beetlenaut
Developer
Posts: 2827
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Custom dialog questions

Post by beetlenaut »

You seem to be unaware that you are working with an API. Every Lua gui command was specifically written and enabled by the game engine's developers. They added those commands as they needed them to build the game engine. You can't just assume that it must do any other thing you can imagine. All the game's other dialog boxes close with a button. I don't see anywhere in the gui documentation that says you can change that, so you probably can't.

You could make a request for more control of the format of a [message], or ask for a new gui command to be added, but it seems like the API doesn't allow exactly what you want at this point.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
ZombieKnight
Posts: 180
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Custom dialog questions

Post by ZombieKnight »

And can I make a workaround?
That I can add a dilog closing function to >space< button?
Okay... can I even register >space< being clicked?
I had saurian in profile before, but I've merged my discord profile with forum one...
Post Reply