Announcement

Collapse
No announcement yet.

How can I distinguish the events from a slider

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How can I distinguish the events from a slider

    Hello,

    I am using the µLCD-32PTU with an arduino and have an visi genie slider on my GUI.
    Now I want to receive both Events of the slider.
    "OnChanging" during the slider is pressed and moving
    and "OnChanged" when the slider is released.

    How can I request it in my code ?

    //If the cmd received is from a Reported Event (Events triggered from the Events tab of Workshop4 objects)
    if (Event.reportObject.cmd == GENIE_REPORT_EVENT)
    {
    if (Event.reportObject.object == GENIE_OBJ_SLIDER) // If the Reported Message was from a Slider
    {
    if (Event.reportObject.index == 0) // If Slider0
    {
    slider_val = genie.GetEventData(&Event); // Receive the event data from the Slider0
    genie.WriteObject(GENIE_OBJ_LED_DIGITS, 0x00, slider_val); // Write Slider0 value to to LED Digits 0
    }
    }
    }

    Thank you
    Thomas


  • #2
    I'm not a support person but I use the same display as you do but I don't use the Adrino chip however the display can be made to send a serial message to your device that contains the type of command, the object type that sent it, the number of the object (ie: slider #1 etc) and the value of the slider. In the user manual there is a table that lists the commands and the object types. Works great...

    Mike B.

    Comment


    • #3
      Thank you Mike,

      I know, but I cant handle the commands in the user manual.
      The best way for me to understand is a example code.
      For example the code I have postet:

      First, I ask if a command is send:

      if (Event.reportObject.cmd == GENIE_REPORT_EVENT)

      Next, what kind of object: a slider

      if (Event.reportObject.object == GENIE_OBJ_SLIDER)

      Next, what number of slider: slider0

      if (Event.reportObject.index == 0)

      And now I have to ask for the OnChanging or the OnChanged event.
      But dont know what's the code for.

      Thomas

      Comment


      • #4
        Here is the app note that covers what you are trying to accomplish: 4D-AN-00002

        Mike B.

        Comment


        • #5
          Sorry, but can't find an answer in the 4D-AN-00002 app note.
          There are also no code examples for the arduino C language.

          Thomas

          Comment


          • #6
            There is no detectable difference between the onChanging and onChanged messages, sorry.

            Can you explain why the difference would be important?
            Mark

            Comment


            • #7
              When I move the slider, the event is fired hunderets of times.
              But I just need one Event at the end of sliding.
              I save the position of the slider in the EEPROM of the ATmega2560.
              The MS-Windows VCL-Components have an OnChange and OnExit-Event (and many more).
              Why has the slider of visi genie these two Events, if I cannot use it in the C code ?

              Thomas


              Comment


              • #8
                It looks like you only need 'onChanged', this only occurs 'once' at the 'end of sliding'.

                'onChanging' occurs every time the cursor position changes.

                I hope that makes sense as to why there are two events.

                Mark

                Comment


                • #9
                  I need the event "onChanged" to write the slider Position into the EEPROM and to transmit this position to the GUI on Windows.
                  This event should be happend only once.

                  The event "onChanging" is used to show the user the exact slider value on the LCD-32PTU Display in realtime.
                  It makes it easier to slide to an desired value. e.g. 75%

                  Thomas

                  Comment


                  • #10
                    Err, the 32PTU will always display the exact slider value in real time, you don't need to create a 'Report Message' event for that.
                    Mark

                    Comment


                    • #11
                      Can you give an example ? In C code.

                      Thomas

                      Comment


                      • #12
                        Just adding a slider will cause its value to be continuously be updated on the display.

                        You don't need any C code for that to happen.

                        I have a feeling I'm not understanding what you are trying to do.
                        Mark

                        Comment


                        • #13
                          Yes, the slider value will continously be updated when moving the slider,
                          But the user has to see it's value !
                          The value of the slider is a analog output value and controlls fans.
                          So it's important to see the exact fan power in %.

                          Thomas

                          Comment


                          • #14
                            So, if you had a form with a slider and an leddigits object.

                            On the slider you set OnChanged to 'Report Message' and OnChanging to 'LedDigits0Set'

                            Wouldn't that achieve what you are after?
                            Mark

                            Comment


                            • #15
                              I had already this idea. But all other values on this form e.g. temperatue, will be displayed by an strings label.
                              If I use an LedDigit for fan performance (slider position), it does not match.

                              Let me say, the Hardware of the Displays is really good.
                              But in software (especially the visi genie components and the control) there are many things to improve.

                              So, carry on guys.

                              Thomas

                              Comment

                              Working...
                              X