Index: demo.tcl ================================================================== --- demo.tcl +++ demo.tcl @@ -9,11 +9,11 @@ wtk::grid [wtk::label .c.islbl -text "is equivalent to"] -column 0 -row 2 -sticky e wtk::grid [wtk::label .c.meters -textvariable meters] -column 1 -row 2 -sticky we wtk::grid [wtk::label .c.mlbl -text "meters"] -column 2 -row 2 -sticky w foreach w [wtk::winfo children .c] {wtk::grid configure $w -padx 50 -pady 50}; #not working yet -wtk::grid [wtk::textarea .text -rows 4 -cols 40 -bg GreenYellow -fg Red -textvariable textval] -column 0 -row 2 -sticky ew +wtk::grid [wtk::text .text -rows 4 -cols 40 -bg GreenYellow -fg Red -textvariable textval] -column 0 -row 2 -sticky ew wtk::grid [wtk::frame .d -padding "3 3 12 12"] -column 0 -row 3 -sticky nwes wtk::grid columnconfigure .d 0 -weight 1; wtk::grid rowconfigure .d 0 -weight 1 wtk::grid rowconfigure . 3 -weight 1 wtk::grid [wtk::button .d.ib -text "" -src /images/logo.png -width 63 -height 63 -command swapimages] -column 0 -row 0 -sticky e ADDED widgets/text.tcl Index: widgets/text.tcl ================================================================== --- /dev/null +++ widgets/text.tcl @@ -0,0 +1,12 @@ + +# TextArea widgets +snit::type text { + _wtkwidget -usetextvar + _wtkoption -cols "" {$JS.cols=$V;} + _wtkoption -rows "" {$JS.rows=$V;} + _wtkoption -bg "" {$JS.style.background='$V';} + _wtkoption -fg "" {$JS.style.color='$V';} + method _createjs {} {return "wtk.createText('[$self id]','[$self cget -text]');"} + method _textchangejs {txt} {return "[$self jqobj].val('$txt');"} + method _event {which args} {if {$which eq "value"} {$self _textchanged -text $args 1}} +} DELETED widgets/textarea.tcl Index: widgets/textarea.tcl ================================================================== --- widgets/textarea.tcl +++ /dev/null @@ -1,12 +0,0 @@ - -# TextArea widgets -snit::type textarea { - _wtkwidget -usetextvar - _wtkoption -cols "" {$JS.cols=$V;} - _wtkoption -rows "" {$JS.rows=$V;} - _wtkoption -bg "" {$JS.style.background='$V';} - _wtkoption -fg "" {$JS.style.color='$V';} - method _createjs {} {return "wtk.createTextarea('[$self id]','[$self cget -text]');"} - method _textchangejs {txt} {return "[$self jqobj].val('$txt');"} - method _event {which args} {if {$which eq "value"} {$self _textchanged -text $args 1}} -} Index: widgets/wtk.js ================================================================== --- widgets/wtk.js +++ widgets/wtk.js @@ -16,11 +16,12 @@ setTimeout(wtk.poller,100); }, poller : function() {$.ajax({type:'GET', url:'wtkpoll.html?sessionid='+wtk.sessionid, dataType:'script', complete: function() {setTimeout(wtk.poller,100);}, - error: function(jqXHR, textStatus, errorThrown) {alert("Server connection interrupted\nPress OK to reconnect.");console.log('ajax error '+textStatus+' '+errorThrown);setTimeout(location.reload(1),200);}});}, + error: function(jqXHR, textStatus, errorThrown) {alert("Server connection interrupted\nPress OK to reconnect.");console.log('ajax error '+textStatus+' '+errorThrown); + setTimeout(location.reload(1),200);}});}, sendto : function(msg) { $.get('wtkcb.html?sessionid='+wtk.sessionid, {cmd : msg});}, /* * Generic widget creation; each widget is an HTML element of a certain type, and is given an * id by the wtk code on the server side which is used to uniquely identify it. @@ -47,12 +48,12 @@ createLabel : function(id, txt) { wtk.CreateWidget(id, 'span', txt,'innerHTML'); }, createEntry : function(id, txt) { wtk.CreateWidget(id, 'input', txt,'value').onkeyup = function() {wtk.entryChanged(id);}; }, entryChanged : function(id) { wtk.sendto('EVENT '+id+' value '+wtk.widgets[id].value); }, - createTextarea : function(id, txt) { wtk.CreateWidget(id, 'textarea', txt,'value').onkeyup = function() {wtk.textareaChanged(id);}; }, - textareaChanged : function(id) { wtk.sendto('EVENT '+id+' value '+wtk.widgets[id].value); }, + createText : function(id, txt) { wtk.CreateWidget(id, 'textarea', txt,'value').onkeyup = function() {wtk.textChanged(id);}; }, + textChanged : function(id) { wtk.sendto('EVENT '+id+' value '+wtk.widgets[id].value); }, createFrame : function(id) { wtk.CreateWidget(id, 'div', '', '');}, createCheckButton : function(id,txt) { var w = wtk.CreateWidget(id,'span', '', '');