[GUI] Listbox questions

Discussion of Lua and LuaWML support, development, and ideas.

Moderators: Forum Moderators, Developers

Post Reply
Smok
Posts: 52
Joined: June 14th, 2016, 11:52 am

[GUI] Listbox questions

Post by Smok » June 17th, 2016, 6:22 am

I work on stable Wesnoth version. I can't change to dev now, becouse i face there of lot of strange errors in code, that on stable works perfect.

1. How can I set listbox variables? I'm trying like this:

Code: Select all

T.listbox {
    id = "the_list", 
    has_minimum = false,
    T.list_definition...
But does not work.

2. How can I delete all items from listbox?

3. I have situation where one listbox is that player chooses from. Rest of listbox, should reload any time selection in first listbox changes. They are only for info purpose. How can I make them unselectable or imitate listbox with unselectable components (but i want to use listbox features like header) ? I tought of solution like: change minimum selected items to 0, use something like this in callback: wesnoth.set_dialog_value(nill, "the_list").

User avatar
vultraz
Community Manager
Posts: 927
Joined: February 7th, 2011, 12:51 pm
Location: Dodging Daleks

Re: [GUI] Listbox questions

Post by vultraz » June 17th, 2016, 6:45 am

1. I think has_minimum is not a key recognized by the API. Otherwise, the id = key is set correctly.

2. 1.13 has a wesnoth.remove_dialog_item() function, but that is not in 1.12 (stable). I'm not sure how to delete items otherwise.

3. You should try a listbox without the toggle_panel sub-widget.
Creator of Shadows of Deception (for 1.12) and co-creator of the Era of Chaos (for 1.12/1.13).
SurvivalXtreme rocks!!!
What happens when you get scared half to death...twice?

Smok
Posts: 52
Joined: June 14th, 2016, 11:52 am

Re: [GUI] Listbox questions

Post by Smok » June 17th, 2016, 8:28 am

vultraz wrote:1. I think has_minimum is not a key recognized by the API. Otherwise, the id = key is set correctly.

2. 1.13 has a wesnoth.remove_dialog_item() function, but that is not in 1.12 (stable). I'm not sure how to delete items otherwise.

3. You should try a listbox without the toggle_panel sub-widget.

1. Here: https://wiki.wesnoth.org/GUIWidgetInstanceWML#Listbox

3. Listbox can contain only toggle_panels and buttons.

gfgtdf
Developer
Posts: 1001
Joined: February 10th, 2013, 2:25 pm

Re: [GUI] Listbox questions

Post by gfgtdf » June 17th, 2016, 1:21 pm

Hmm even it if supports it somehow it doent mean it is for example tested to work with the lua api which was afaik written with the asumption that listbox have exactly one selected element. So, you can test it but i wouldnt be too suprised i it doesn't work very well.

In 1.13 you coudl try to use treeviews, they have similar functionality to listboxes but can contain different type of elements, so you coudl define a 'selectable' and a 'non-selectable' node type.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.

Post Reply