PDA

View Full Version : [SOLVED]'broken' slider when created without label at first (ST 0.96)



momesana
15 Oct 2010, 8:54 AM
Hi,
I've run into an issue when creating a Slider on ST 0.96 without a label . Creating a slider with a label and hiding it afterwards however works, so I am wondering if it's me doing something wrong or a bug in Sencha.

Here is sample code to highligh the issue:


Ext.setup({
fullscreen: true,
statusBarStyle: 'black-translucent',
icon: 'icon.png',
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
glossOnIcon: true,
onReady: function() {
var screen = new Screen();
screen.show();
}
});

MyToggle = Ext.extend(Ext.form.Toggle, {

initComponent: function() {

changeEventHandler = function() {
this.fireEvent('toggled', this.getValue() == 1);
}

Ext.apply(this, {
listeners: {
'change': changeEventHandler
}
})

MyToggle.superclass.initComponent.apply(this, arguments);
}
});

Ext.reg('mytoggle', MyToggle);

Screen = Ext.extend(Ext.Panel, {

initComponent: function() {

this.headerCnt = new Ext.Container({
layout: 'fit',
html: '<h>This is a header</h>'
});

// Slide without label
this.slider = new Ext.form.Slider({
value: 60,
minvalue: 0,
maxValue: 100
});

// Slider withlabel
this.slider2 = new Ext.form.Slider({
label: 'values:',
value: 60,
minvalue: 0,
maxValue: 100
});

this.toggle = new MyToggle({
label: 'toggle slider label'
});

Ext.apply(this, {
cls: 'screen',
fullscreen: true,
layout: 'vbox',
items: [this.headerCnt, this.slider, this.slider2, this.toggle]
});

this.toggle.on('toggled', function(b) {
var el = this.slider2.labelEl;
if (el == null || el == undefined) return;
b ? el.show() : el.hide();
}, this);

Screen.superclass.initComponent.apply(this, arguments);
},

afterRender: function() {
Screen.superclass.afterRender.apply(this, arguments);
}
});

Ext.reg('screen', Screen);


Thanks in advance

Wakebrad
29 Oct 2010, 3:08 PM
I'm having this same problem. Did you find a solution?

momesana
30 Oct 2010, 6:26 AM
I'm having this same problem. Did you find a solution?

I tried it on windows a few days ago with ST0.97 and the issue wouldn't show up there. I'll look into this in a few hours on my gentoo box at home.

Cheers

jacstofberg
30 Oct 2010, 9:36 AM
I had the same problem in 0.96. If I did not assign a label to the slider, it just would not work. The good news is that it works perfectly in 0.97 and onward. Tested on PC environment as well as iPod touch and Android 2.2.

I think you should mark this one solved.

momesana
30 Oct 2010, 3:12 PM
yep, just tried with 0.96 and 0.97. It's obviously been solved in 0.97 :-).