Revision: 1751
http://svn.sourceforge.net/vexi/?rev=1751&view=rev
Author: clrg
Date: 2007-03-26 08:45:15 -0700 (Mon, 26 Mar 2007)
Log Message:
-----------
Can add notes by holding control key
Modified Paths:
--------------
some_apps/trunk/org.vexi.simplysudoku/number.t
Modified: some_apps/trunk/org.vexi.simplysudoku/number.t
===================================================================
--- some_apps/trunk/org.vexi.simplysudoku/number.t 2007-03-26 14:31:27 UTC
(rev 1750)
+++ some_apps/trunk/org.vexi.simplysudoku/number.t 2007-03-26 15:45:15 UTC
(rev 1751)
@@ -1,64 +1,116 @@
<!-- GPL v2 -->
<vexi xmlns:wi="vexi.widget" xmlns:ui="vexi://ui">
- <wi:border border="grey" depth="1" enabled="true">
- <ui:box id="control" packed="false" display="false" fill="#FFAAAA" />
- <ui:box id="content" packed="false" fontsize="16" />
-
- minheight = vexi.ui.font.height($content.font, $content.fontsize, "dy") +
12;
- minwidth = minheight;
- focused ++= function(v) { $control.display = v; }
- value ++= function(v) { $content.text = v; }
- value ++= function() { return $content.text; }
-
- thisbox.numset ++= function(v) { $content.textcolor = v ? "#666666" :
"black"; }
-
- var tip = false;
-
- thisbox.highlight = function(v)
- {
- if (tip) return;
- tip = true;
- $content.textcolor = "red";
- vexi.thread = function(v)
- {
- vexi.thread.sleep(2000);
- $content.textcolor = numset ? "#666666" : "black";
- }
- }
-
- //thisbox.check = function(n, v) { vexi.log.info("Implement
number.check()"); }
- //thisbox.move = function(n, v) { vexi.log.info("Implement
number.move()"); }
-
- KeyPressed ++= function(v)
- {
- switch (v)
- {
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if (!numset and check(thisbox, v)) $content.text = v;
- break;
- case "delete":
- case "back_space":
- if (numset) break;
- check(thisbox, "");
- $content.text = "";
- break;
- case "left":
- case "right":
- case "up":
- case "down":
- move(thisbox, v);
- }
- }
-
- </wi:border>
- <org.vexi.lib.role.focusable />
+ <wi:border border="grey" depth="1" enabled="true">
+ <ui:box id="control" packed="false" display="false" fill="#FFAAAA" />
+ <ui:box id="content" packed="false" fontsize="16" />
+ <wi:pad id="notes" packed="false" fontsize="8" padding="0 1 1 1" />
+
+ minheight = vexi.ui.font.height($content.font, $content.fontsize,
"dy") + 12;
+ minwidth = minheight;
+
+ thisbox.focused ++= function(v) { $control.display = v; }
+ thisbox.value ++= function(v) { $content.text = v; }
+ thisbox.value ++= function() { return $content.text; }
+ thisbox.numset ++= function(v) { $content.textcolor = v ? "#666666" :
"black"; }
+
+ var notes = null;
+ var tip = false;
+
+ thisbox.addnote = function(v)
+ {
+ for (var i = 0; $notes.numchildren > i; i++)
+ {
+ if ($notes[i].text == v)
+ {
+ $notes[i] = null;
+ return;
+ }
+ }
+ var b = vexi.box;
+ b.textcolor = "#666666";
+ b.fontsize = $notes.fontsize;
+ b.packed = false;
+ b.shrink = true;
+ b.text = v;
+ switch (v)
+ {
+ case '1': b.align = "topleft"; break;
+ case '2': b.align = "top"; break;
+ case '3': b.align = "topright"; break;
+ case '4': b.align = "left"; break;
+ case '5': b.align = "center"; break;
+ case '6': b.align = "right"; break;
+ case '7': b.align = "bottomleft"; break;
+ case '8': b.align = "bottom"; break;
+ case '9': b.align = "bottomright"; break;
+ }
+ $notes[$notes.numchildren] = b;
+ }
+
+ thisbox.highlight = function(v)
+ {
+ if (tip) return;
+ tip = true;
+ $content.textcolor = "red";
+ vexi.thread = function(v)
+ {
+ vexi.thread.sleep(2000);
+ $content.textcolor = numset ? "#666666" : "black";
+ }
+ }
+
+ //thisbox.check = function(n, v) { vexi.log.info("Implement
number.check()"); }
+ //thisbox.move = function(n, v) { vexi.log.info("Implement
number.move()"); }
+
+ KeyPressed ++= function(v)
+ {
+ switch (v)
+ {
+ case 'C-1': addnote('1'); break;
+ case 'C-2': addnote('2'); break;
+ case 'C-3': addnote('3'); break;
+ case 'C-4': addnote('4'); break;
+ case 'C-5': addnote('5'); break;
+ case 'C-6': addnote('6'); break;
+ case 'C-7': addnote('7'); break;
+ case 'C-8': addnote('8'); break;
+ case 'C-9': addnote('9'); break;
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ if (numset) break;
+ if (check(thisbox, v))
+ {
+ $content.text = v;
+ $notes.display = false;
+ }
+ break;
+ case "C-delete":
+ case "C-back_space":
+ while($notes.numchildren) $notes[0] = null;
+ break;
+ case "delete":
+ case "back_space":
+ if (numset) break;
+ check(thisbox, "");
+ $content.text = "";
+ $notes.display = true;
+ break;
+ case "left":
+ case "right":
+ case "up":
+ case "down":
+ move(thisbox, v);
+ }
+ }
+
+ </wi:border>
+ <org.vexi.lib.role.focusable />
</vexi>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Vexi-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vexi-svn