Crystal Hammer
21-08-2014 20:48:24
So this is probably the final evolution of my custom code.
(For reference, the older float value slider class is there: viewtopic.php?f=17&t=29445)
What is it allows you to do:
(For reference, the older float value slider class is there: viewtopic.php?f=17&t=29445)
What is it allows you to do:
- Shorten the Gui initialization code (a lot) when you have plenty of:
- sliders with value text (bound to some float, by pointer)[/*]
- sliders with editbox (both change the value and update itself)[/*]
- checkboxes (bound to some bool)[/*][/list:u][/*]
- Add an event when the value changed, and run your code after[/*]
- Easily change the pointer later[/*]
- Update slider (value and edit too) if you changed the value yourself (just 1 call)[/*]
- Simply change the TextBox to EditBox (just in .layout) if you want to also be able to edit the value, not only show it[/*]
- Use power exponent for slider value (default is 1)[/*]
- RMB on slider resets to default value, set earlier by a method (or default 0.5)[/*]
- Plenty formatting options for value
- Specify how many digits after dot and how many in total (for float)[/*]
- You can add suffix after value, and use scale for the value displayed[/*]
- Use string map if you want to show strings not integer values[/*]
[/list:u]
[/*]
[/list:u]
For more info see the comments in example use code in _Options.cpp (with _Options.layout) and in SliderValue.h.
Probably only <Resource type="ResourceLayout" name="Slider" version="3.2.0"> is needed in templates but I inluded the whole skin.
Example screenshot from editor using those.
http://i.imgur.com/Cml1yRM.jpg
Scale has both editbox and slider rest are just sliders and value text.
This also shows the use for pointer change. We have max 6 layers, and on changing layer (click on tab or key press) the slider's pointer change to those float values from other layer, and they get updated on Gui.
Here, a bit covered but the bottom sliders also have edits.
http://i.imgur.com/tMsBsdt.jpg
- Specify how many digits after dot and how many in total (for float)[/*]
- sliders with value text (bound to some float, by pointer)[/*]