Article View: adobe.photoshop.scripting
Article #1862Javascript scrollbars
From: johnbeardy
Date: Mon, 19 Jul 2004 15:32
Date: Mon, 19 Jul 2004 15:32
28 lines
1766 bytes
1766 bytes
Is there some issue setting the initial value of scrollbars? Maybe a problem with negative minimum values?
I am building a dialog in which the user can choose a value between -90 and +90 from a scrollbar. The scrollbar "sb1" has an edit box showing its current value.
When I run the dialog and click the slider's step arrows, the slider's valued is incremented but starting at 0, rather than at -50 as set when it was created. Code below.
Any ideas?
John
var dlg = new Window ('dialog', 'Layer settings', [100,100,670,270])
dlg.msgPnl = dlg.add('panel', [10,20,550,160], 'Angles of slices');
//bunch of variables : there are more scrollbars in actual script
var btnHeight = 20 ;
var r1 = 30 ;
var r3 = 20 ;
var r2 = r3 + btnHeight * 1.5 ;
var r4 = 100 ;
var c1 = 20;
var w = 100;
btn1 = dlg.msgPnl.add ('button', [c1+w*4,r4,c1+w*5,r4+btnHeight], '&OK' , {name:'OK'});
sb1 = dlg.msgPnl.add ('scrollbar', [c1,r3,c1+w,r3+btnHeight], -50,-90,90);
sb1.onChange = function () {txt1.text = this.value;} ;
sb1.value = -50;
txt1 = dlg.msgPnl.add ('edittext', [w/2,r2,w/2+30,r2+btnHeight], sb1.value);
btn1.onClick = function () {this.parent.parent.close(); } ;
dlg.show();
Technical Details
Message-ID:
<3bb51925.-1@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!webxShow Full Headers
Complete Article Headers
X-Google-Thread: f5839,86c18e3af5e24db0,start X-Google-Attributes: gidf5839,public X-Google-Language: ENGLISH,ASCII-7-bit From: johnbeardy@adobeforums.com Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.photoshop.scripting Subject: Javascript scrollbars Message-ID: <3bb51925.-1@webx.la2eafNXanI> Date: Mon, 19 Jul 2004 08:32:56 -0700 Lines: 36 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit