ZZufyUI文档首页DocumentationДокументацияDokumentationDocumentationDocumentación

正在准备文档Preparing your docsПодготовка документацииDokumentation wird geladenPréparation de la documentationPreparando la documentación

Language

API reference / v1.29.1

Selection & input

CheckBox, RadioButton, RadioGroup, ToggleSwitch, Slider, NumberBox

Download Markdown

Several of these emit a "live" signal during the drag and a separate "commit" signal. The static DrawBox is shared with data views, so changing its look changes list/table/tree check rows too.

CheckBox

enum class State { Unchecked, PartiallyChecked, Checked };
ZSignal<bool> Toggled;   ZSignal<State> StateChanged;
void SetChecked(bool);  void SetState(State);  void Toggle();  void SetTriState(bool);
static void DrawBox(...);

RadioButton / RadioGroup

class RadioButton { ZSignal<bool> CheckedChanged; ZSignal<> Clicked; void SetChecked(bool); };
class RadioGroup  { enum class Orientation { Vertical, Horizontal };
                    ZSignal<int> SelectionChanged;
                    std::function<bool(int newIdx, int oldIdx)> SelectionChanging;   // false vetoes
                    int AddItem(const std::wstring&);   int AddItemSelected(const std::wstring&, bool selected);
                    int AddButton(std::shared_ptr<RadioButton>);   int AddButtonSelected(std::shared_ptr<RadioButton>, bool selected);
                    std::shared_ptr<RadioButton> GetButton(int index) const; int GetItemCount() const; void SetSelectedIndex(int); ... };

Pitfall

  • a lone RadioButton does not enforce exclusion — RadioGroup does.
  • Version: v1.11.0.

ToggleSwitch

ZSignal<bool> Toggled;   void SetOn(bool);  bool IsOn() const;
void SetIndeterminate(bool);   // half-selected appearance
inline static float DefaultAnimationDuration;   // full animation duration (s), default 0.18
  • Default 50×24.
  • Click toggles on mouse up; press and drag left/right makes the knob follow the pointer, and release commits based on drag progress >= 0.5. The track colour follows the drag progress.
  • Version: since v1.21.0 the knob/track/hover animation is duration-driven ease-in-out; v1.26.0 adds WinUI3-style press-drag and changes the default duration to 0.18 s. SetAnimationSpeed still means "larger = faster" (converted to a duration multiplier).

Slider

ZSignal<float> ValueChanged;   ZSignal<> SliderReleased;
void SetRange(float min,float max);  void SetValue(float);  void SetStep(float);  void SetSnapToStep(bool);
float GetDisplayValue() const;   // animated display value (thumb position); useful for debug/tests

Pitfall

  • ValueChanged fires continuously during a drag; commit with SliderReleased.
  • Normal dragging is immediate (the thumb follows the pointer); only clicking the track or using SetSnapToStep eases the display value to the target/snap point.
  • Version: v1.18.0 fixes the zero-width NaN path; v1.26.0 distinguishes drag/click/snap easing and adds GetDisplayValue().

NumberBox (with internal SpinButton)

ZSignal<double> ValueChanged;   ZSignal<const std::wstring&> TextChanged;
void SetValue(double, bool fire=true);  void SetRange(double lo,double hi);
void SetStep(double);  void SetDecimals(int);  void SetWrap(bool);
void SetDefaultValue(double);  void ResetToDefault();

Pitfall

  • empty text is treated as an error by the control; step buttons call CommitText() first, so an unfocused edited value is not lost.
  • Version: v1.12.0; ResetToDefault error-clear v1.12.2.
View sourcedocs/src/API.en.md