Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-14065

Android: Slider fires 'change' event when it is laid out

    Details

    • Type: Bug
    • Status: Reopened
    • Priority: Low
    • Resolution: Unresolved
    • Affects Version/s: Release 3.2.0
    • Fix Version/s: None
    • Component/s: Android
    • Environment:

      Tested in iphone simulator and Android device (HTC Sensation, ICS v4.0.3)
      Titanium SDK 3.1

      Android 4.1.2
      Ti SDK 3.2 CI
      Titanium Studio, build: 3.1.0.201303032333

      Description

      Problem
      When a 'change' event is added to a slider like this:

      var win1 = Titanium.UI.createWindow({
      	backgroundColor: 'gray'
      });
       
      var slider = Titanium.UI.createSlider({
          top: 50,
          min: 0,
          max: 100,
          width: '100%',
          value: 50
          });
       
      slider.addEventListener('change', onSliderChange)
       
      function onSliderChange() {
      	
      	alert('Slider says: Hello World!')
      }
       
      win1.add(slider);
      win1.open();
      
      

      While I believe that it makes sense in some cases, in others, it's a problem.

      In my particular case, if the callback is launched when the window opens, it causes a problem because it should be fired only when the user moves the slider.

      I don't know what you think of this but I believe it makes more sense that the 'change' event is not fired when the slider is simply added to the view.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              clathrop Carter Lathrop
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-16619
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Source Code