Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14065] Android: Slider fires 'change' event when it is laid out

GitHub Issuen/a
TypeBug
PriorityLow
StatusReopened
ResolutionUnresolved
Affected Version/sRelease 3.2.0
Fix Version/sn/a
ComponentsAndroid
Labelsalloy, mobile, reprod, slider
ReporterCarter Lathrop
AssigneeUnknown
Created2013-05-30T15:16:20.000+0000
Updated2018-02-28T20:04:21.000+0000

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

FileDateSize
Archive.zip2013-05-31T07:59:31.000+00003683648

Comments

  1. Carter Lathrop 2013-05-30

    Hello Kevin, Thanks for bringing this to our attention. Would you mind providing a full test case of this issue? In order to review a bug we require a test case which can easily be added into an app.js or alloy project which displays the bug at hand. This is pertinent because it ensures a speedy review and that the problem is understood between everyone involved. Once you have provided the test case I will look into this further. For future reference: https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report Thank you for your cooperation, Carter
  2. Kevin Purnelle 2013-05-31

    app folder and tiapp.xml for test case. (This is an Alloy project)
  3. Carter Lathrop 2013-05-31

    Kevin, I couldn't get your project to work, I just made my own test case to show the issue. This is indeed a bug (or at least questionable behavior). Tested and confirmed with Android 4.1.2 on Ti SDK 3.2 CI. Moving to Ti-Mobile for engineering to review. Thanks for bringing this to our attention. Regards, Carter
  4. Mark Mokryn 2013-10-03

    Just make sure to ignore any slider change events prior to the first touchstart event and it's OK.
  5. Lee Morris 2017-07-18

    I am able to reproduce this issue with the following environment; Pixel (7.1) Studio 4.9.0.201705302345 Ti SDK 6.1.1 GA Appc NPM 4.2.9 Appc CLI 6.2.2 Ti CLI 5.0.14 Alloy 1.9.11 Xcode 8.2 (8C38) Node v4.8.2 Java 1.8.0_131
  6. Rene Pot 2018-01-23

    I feel like this bug could use some attention. Right now when a slider is implemented with a pre-defined value a workaround is needed.

JSON Source