[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[sc-dev] SF.net SVN: supercollider:[8146] trunk/build/Help/GUI/SCUserViewSubclassing /SCUserViewTutorial.sc
Revision: 8146
http://supercollider.svn.sourceforge.net/supercollider/?rev=8146&view=rev
Author: jmfuo
Date: 2008-12-15 14:18:19 +0000 (Mon, 15 Dec 2008)
Log Message:
-----------
improved SCUserView tutorial template
Modified Paths:
--------------
trunk/build/Help/GUI/SCUserViewSubclassing/SCUserViewTutorial.sc
Modified: trunk/build/Help/GUI/SCUserViewSubclassing/SCUserViewTutorial.sc
===================================================================
--- trunk/build/Help/GUI/SCUserViewSubclassing/SCUserViewTutorial.sc 2008-12-15 14:14:51 UTC (rev 8145)
+++ trunk/build/Help/GUI/SCUserViewSubclassing/SCUserViewTutorial.sc 2008-12-15 14:18:19 UTC (rev 8146)
@@ -1,10 +1,10 @@
// How to subclass SCUserView to make custom GUI interfaces
-// For many purposes you can use this as a template, and simply adjust the methods. - by jostM
+// For many purposes you can use this as a template, and simply adjust the methods
MyWidget : SCUserView {
// (1) Setup instance vars appropriate to your widget. Make sure to define value.
- var <>step, <>value=0, <>leftColor, <>rightColor, <>thumbWidth=7;
+ var <>step, <value=0, <>leftColor, <>rightColor, <>thumbWidth=7;
// (2) Set the viewClass to SCUserView
*viewClass { ^SCUserView } // this ensures that SCUserView's primitive is called
@@ -43,11 +43,14 @@
// (5) define typical widget methods (only those you need or adjust as needed)
valueAction_{ arg val; // most widgets have this
+ this.value=val;
+ this.doAction;
+ }
+ value_{ |val| // in many widgets, you can change the
+ // value and refresh the view , but not do the action.
value=val;
- this.doAction;
this.refresh;
}
-
// these are like in SCSlider
increment { |zoom=1| ^this.valueAction = this.value + (max(this.step, this.pixelStep) * zoom) }
decrement { |zoom=1| ^this.valueAction = this.value - (max(this.step, this.pixelStep) * zoom) }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
_______________________________________________
sc-dev mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-dev/
search: https://listarc.bham.ac.uk/lists/sc-dev/search/