No announcement yet.

Need some help with Sliders

  • Filter
  • Time
  • Show
Clear All
new posts

  • Need some help with Sliders

    Hello! I've recently bought one of your gen4-43DCT displays, and wanted to try doing some simple programming to learn the language, but i've met some problems.

    For a simple test i wanted to try and make a tank display the average value of 2 sliders, the sliders seem simple, but just pasting the code seems to cause some problems, one being the value of "y" and "posn" in the following:

    img_Show(hndl,iSlider1) ; // show initialy, if required
        img_ClearAttributes(hndl, iSlider1, I_TOUCH_DISABLE); // set to enable touch, only need to do this once
        posn := y - 8 ;                        // y - top - 8
        if (posn < 0)
            posn := 100 ;                       // maxvalue-minvalue
        else if (posn > 255)                    // height - 17)
            posn := 0 ;
            posn := 100 - 100 * posn / 255 ;    // max-min - (max-min) * posn / (height-17)
        img_SetWord(hndl, iSlider1, IMAGE_INDEX, posn);
        img_Show(hndl, iSlider1);
    when just pasting the code the variables aren't made, so i wrote them both up, posn obviously gets set dependent on the first equation with y, but i haven't been able to find any information on what that should be set to.

    Any help is much appreciated, thanks!

  • #2

    Welcome to the Forum!

    Have you seen this application note?

    ViSi Input Objects

    On that application note, y is equated to touch_Get(TOUCH_GETY);

    That will store the y coordinate of the touch occurrence to the variable 'y'.

    If you have more inquiries, please don't hesitate to ask.

    You could also consult our application notes for other relevant information.

    Application Notes:

    I hope this helps.

    Best regards,
    Last edited by michael_4D; 29th November 2018, 12:17 PM.


    • #3
      this helped a lot! got my sliders working now, thanks a lot for the help.