none
LDControls Slider, can you get a more accuate value RRS feed

  • Question

  • Hello,

    I am trying to use LDControls Sliders to pick colours (one for red value, one for green and one for blue) however the sliders only return a value between 0 and 100. Is there any way for instance to get them to return a value between 0 and 255.

    Thanks.

    Sunday, January 10, 2016 3:41 PM

Answers

  • I tested with
    sl= LDControls.AddSlider(511,40,"H")
    LDControls.SliderChanged=slid
    
    Sub slid
      val= LDControls.SliderGetValue(sl)
      val=LDRegex.Replace(val,",",".","True")  ' see NOTE
      val= Math.Round(val*2.55)
      GraphicsWindow.Title=val
    EndSub
    
    '' NOTE: the replace is needed because in my SB val has a comma instead of a dot
    ''  and cannot be used in calculation
    and see every value from 1 to 255.

    Jan [ WhTurner ] The Netherlands

    Sunday, January 10, 2016 5:53 PM
    Answerer
  • (translated by Google translator)

    You can multiply the value of the Slider to 2.55

    Sunday, January 10, 2016 4:02 PM
  • The accuracy is greater than you think, even if the maximum is 100, you get back intermediate values at 0.1 intervals I think.

    GraphicsWindow.Show()
    'LDControls.SliderMaximum = 255
    slider = LDControls.AddSlider(200,10,"H")
    LDControls.SliderChanged = OnSliderChanged
    
    Sub OnSliderChanged
      GraphicsWindow.Title = LDControls.SliderGetValue(slider)
    EndSub
    I did add a SliderMaximum property for convenience (uploaded to beta version of extension), but AbsoluteBeginner's solution is the answer I think.

    Sunday, January 10, 2016 5:43 PM
    Moderator

All replies

  • (translated by Google translator)

    You can multiply the value of the Slider to 2.55

    Sunday, January 10, 2016 4:02 PM
  • (translated by Google translator)

    You can multiply the value of the Slider to 2.55


    That does not provide accurate values though as I would have to round or truncate. 
    Sunday, January 10, 2016 4:39 PM
  • The accuracy is greater than you think, even if the maximum is 100, you get back intermediate values at 0.1 intervals I think.

    GraphicsWindow.Show()
    'LDControls.SliderMaximum = 255
    slider = LDControls.AddSlider(200,10,"H")
    LDControls.SliderChanged = OnSliderChanged
    
    Sub OnSliderChanged
      GraphicsWindow.Title = LDControls.SliderGetValue(slider)
    EndSub
    I did add a SliderMaximum property for convenience (uploaded to beta version of extension), but AbsoluteBeginner's solution is the answer I think.

    Sunday, January 10, 2016 5:43 PM
    Moderator
  • I tested with
    sl= LDControls.AddSlider(511,40,"H")
    LDControls.SliderChanged=slid
    
    Sub slid
      val= LDControls.SliderGetValue(sl)
      val=LDRegex.Replace(val,",",".","True")  ' see NOTE
      val= Math.Round(val*2.55)
      GraphicsWindow.Title=val
    EndSub
    
    '' NOTE: the replace is needed because in my SB val has a comma instead of a dot
    ''  and cannot be used in calculation
    and see every value from 1 to 255.

    Jan [ WhTurner ] The Netherlands

    Sunday, January 10, 2016 5:53 PM
    Answerer
  • @ Jan,

    ..in my SB val has a comma instead of a dot

    See my post LD-MediaPlayer or LDUtilities.GetCultureInvariantNumber

    Permanent solution:

    ControlPanel -> Region & Settings (rundll32.exe C:\Windows\System32\shell32.dll,Control_RunDLL C:\Windows\System32\intl.cpl) or simply intl.cpl from RunBox or CmdLine -> Button "Further Settings"  (? or similar). Red marked settings, and NO more probs about   . point <-> comma ,


    Sunday, January 10, 2016 9:42 PM
    Answerer