[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[sc-dev] SF.net SVN: supercollider:[8144] trunk/build/Help/GUI/SCUserViewSubclassing /SCUserViewTutorial.sc
Revision: 8144
http://supercollider.svn.sourceforge.net/supercollider/?rev=8144&view=rev
Author: jmfuo
Date: 2008-12-15 14:04:29 +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 13:58:40 UTC (rev 8143)
+++ trunk/build/Help/GUI/SCUserViewSubclassing/SCUserViewTutorial.sc 2008-12-15 14:04:29 UTC (rev 8144)
@@ -1,5 +1,5 @@
// How to subclass SCUserView to make custom GUI interfaces
-// For many purposes you can use this as a template, and simply adjust the methods
+// For many purposes you can use this as a template, and simply adjust the methods. - by jostM
MyWidget : SCUserView {
@@ -59,27 +59,33 @@
// (6) override mouseActions
- mouseDown{arg x, y, modifiers, buttonNumber, clickCount;
-
+ mouseDown{ arg x, y, modifiers, buttonNumber, clickCount;
+ var newVal;
// this allows for user defined mouseDownAction
mouseDownAction.value(this, x, y, modifiers, buttonNumber, clickCount);
// set the value and do the action
(modifiers == 256).if{ // restrict to no modifier
- this.valueAction_( (x).linlin(this.bounds.left,this.bounds.left+this.bounds.width,0,1));
+
+ newVal= x.linlin(this.bounds.left,this.bounds.left+this.bounds.width,0,1);
// translates the mouse position in pixels to a relative value between 0 and 1
+
+ if (newVal != value) {this.valueAction_(newVal)}; // only do something if the value changed
};
}
- mouseMove{arg x, y, modifiers, buttonNumber, clickCount;
-
+ mouseMove{ arg x, y, modifiers, buttonNumber, clickCount;
+ var newVal;
// this allows for user defined mouseMoveAction
mouseMoveAction.value(this, x, y, modifiers, buttonNumber, clickCount);
// set the value and do the action
(modifiers == 256).if{ // restrict to no modifier
- this.valueAction_( (x).linlin(this.bounds.left,this.bounds.left+this.bounds.width,0,1));
+
+ newVal= x.linlin(this.bounds.left,this.bounds.left+this.bounds.width,0,1);
// translates the mouse position in pixels to a relative value between 0 and 1
+
+ if (newVal != value) {this.valueAction_(newVal)}; // only do something if the value changed
};
}
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/