Paste: button action - how?
Author: | besimo |
Mode: | factor |
Date: | Fri, 12 Jun 2009 20:50:00 |
Plain Text |
Hi all,
i have a problem, when pressing a button.
USING: kernel accessors sequences ui.gadgets.editors ui.gadgets.frames ui.gadgets.grids ui.gadgets.labels ui.gadgets.buttons ui ;
IN: ui2
: change-gui ( object -- object )
dup children>> dup . 0 swap ?nth dup . dup editor-string "\n factor rocks" append swap set-editor-string ;
: gooo ( -- frame )
2 2 <frame> { 1 1 } >>filled-cell { 100 50 } >>gap dup
<multiline-editor> { 0 0 } grid-add
"hello" <label> { 1 0 } grid-add
"send" <label> [ drop change-gui ] <border-button> { 1 1 } grid-add
"hello" <label> { 0 1 } grid-add
"open" open-window ;
MAIN: gooo
But it tells me "Data Stack Underflow".
If i execute the content of my word change-gui (and of course, change the quotation of the button just to [ drop ] and typing it into the scratchpad it works.
Author: | yuuki |
Mode: | factor |
Date: | Mon, 15 Jun 2009 08:30:06 |
Plain Text |
USING: kernel accessors sequences ui.gadgets.editors ui.gadgets.frames ui.gadgets.grids ui.gadgets.labels ui.gadgets.buttons ui ;
IN: ui2
: change-gui ( object -- )
children>> 0 swap ?nth dup editor-string "\n factor rocks" append swap set-editor-string ;
: gooo ( -- frame )
2 2 <frame> { 1 1 } >>filled-cell { 100 50 } >>gap dup
<multiline-editor> { 0 0 } grid-add
"hello" <label> { 1 0 } grid-add
"send" <label> [ parent>> change-gui ] <border-button> { 1 1 } grid-add
"hello" <label> { 0 1 } grid-add
"open" open-window ;
MAIN: gooo
New Annotation