Topic: UI Spinbox: dynamic max value?
kaputtnik![]() Topic Opener |
Posted at: 2024-05-20, 16:52
I am trying to adjust the max value of a spinbox depending on the amount of a ware. But for some reason this won't do. Code snippet:
But for some reason i can't change this value. Code snippet to change:
The print statement says:
So the Spinbox is found, but the Any hints? Fight simulator for Widelands: ![]() ![]() |
Nordfriese![]() |
Posted at: 2024-05-20, 19:15
The documentation you linked doesn't mention any property named Use the method Rationale for the choice of which properties are available and which are not is what is immediately available in the C++ interface of each component, and which would involve writing a dedicated new getter and/or setter function. ![]() ![]() |
kaputtnik![]() Topic Opener |
Posted at: 2024-05-20, 21:26
Oh yes... i just misinterpreted the header Many thanks! Fight simulator for Widelands: ![]() ![]() |
kaputtnik![]() Topic Opener |
Posted at: 2024-06-12, 18:13
I have now trouble to dynamically change the values of a spinbox when using Initializing:
Try to change:
Did i overlooked something again? If this is not possible with a spinbox, can i use a discrete_slider for this? Fight simulator for Widelands: ![]() ![]() |
Nordfriese![]() |
Posted at: 2024-06-12, 18:54
Well the documentation is a comprehensive list of all known properties and values Value list spinboxes are somewhat fiddly. Internally, a value list with I would suggest that if you want to use a spinbox, you can imitate that behaviour in Lua using Replacements: Initially create the spinbox as a regular spinner with interval 1 to 1, and then update your values for a size- Alternatively consider using a dropdown, this has one of the most flexible interfaces of all widgets.
Lua syntax alert: This needs a semicolon or newline between the two function calls. ![]() ![]() |
kaputtnik![]() Topic Opener |
Posted at: 2024-06-13, 15:24
The problem for a beginner is that some properties can be changed just by assigning a new value to the ui-element, and for some values one has to use the appropriate functions mentioned in the detailed description of the ui element to change a value. Probably the descriptions of ui elements below create_child() should get links to the detailed descriptions, e.g. spinbox in chapter create_child() should get a link to SpinBox. Anyway, thanks for your answer again Fight simulator for Widelands: ![]() ![]() |