Code Monkey home page Code Monkey logo

advanced-numeric-input_and_slider's Introduction

UserControlTesterProject

Tested some concepts for an advanced numeric input control, and also for a slider supporting double values. This was only a test, so use it and change it if you find it useful for your tasks. Note: you might need to rebuild the solution after cloning, if you cannot open the designer files.

Features for both UserControls:

  • User inputs validated via both events lost focus and Enter key up
  • Programmatic value setting
  • Settable validation background color during edit mode
  • Range limit min/max
  • Optionally coerce or ignore out of range inputs
  • Capture and ignore wrong inputs
  • Set or hide tooltip
  • Standard NumberFormatSpecifier option (default is "G")
  • Controls on UI are resizable in design time (AdvancedSlider has only slider resize option)
  • EnterKeyUpCustom, FocusLostCustom, InvalidInput, OutOfRange, ValueChangedFinal (not including slider scroll intermediate values), ValueChanged (including slider scroll events too) events

AdvancedSlider:

  • Handles double values. TrackBar range is now fixed to 0-1000 (SliderResolution), so the slider double resolution is (Max-min)/1000. You can change this if needed.
  • Set label text
  • Set SmallChange/LargeChange for slider
githubexample1.mp4

Some usage examples in the project:

{
            InitializeComponent();
            //advancedNumericBox1.NumberFormatSpecifier = "E3";
            advancedNumericBox1.EnterKeyUpCustom += AdvancedNumericBox1_EnterKeyUpCustom;
            advancedNumericBox1.FocusLostCustom += AdvancedNumericBox1_FocusLostCustom;
            advancedNumericBox1.InvalidInput += AdvancedNumericBox1_InvalidInputOccured;
            advancedNumericBox1.OutOfRange += AdvancedNumericBox1_OutOfRange;

            advancedNumericBox1.SetMinimum(-100);
            advancedNumericBox1.SetMaximum(500);
            advancedNumericBox1.EnableToolTip($"Min: -100\r\nMax: 500\r\nOut of range will be coerced.");
            advancedNumericBox1.SetValue(100);
            advancedNumericBox1.CoerceOutOfRange = true;

            advancedSlider1.EnterKeyUpCustom += AdvancedNumericBox1_EnterKeyUpCustom;
            advancedSlider1.FocusLostCustom += AdvancedNumericBox1_FocusLostCustom;
            advancedSlider1.InvalidInput += AdvancedNumericBox1_InvalidInputOccured;
            advancedSlider1.OutOfRange += AdvancedNumericBox1_OutOfRange;

            advancedSlider1.SetLabel("parameter:");
            advancedSlider1.SetMinimum(-300);
            advancedSlider1.SetMaximum(500);
            advancedSlider1.EnableToolTip($"Min: -300\r\nMax: 500\r\nOut of range will be coerced.");
            advancedSlider1.SetValue(100);
            advancedSlider1.CoerceOutOfRange = true;
}

advanced-numeric-input_and_slider's People

Contributors

bukkideme avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.