: onclick \ g --

g:parent

g:form-data

... ;



: g:form-data \ g -- o

\ return value

{} >r



\ iterate the gui, and for each 'edit' or 'combo' get its value and stash it

(

g:name dup null? if

\ no name, ignore

2drop

else

\ name, so let's process it

\ g name

swap g:text? \ name g text

nip dup null? if

2drop

else

r> -rot o:! >r

then

then

) g:each

drop r> ;



Often you have a GUI form, with a bunch of entry fields laid out nicely. You press "OK" ... and then what?Well, you have to pick out the user's data from your form, which necessitates using "g:child" with a name (or index). Here's a nicer way.Assuming you put your edits, etc inside a 'box', and the "OK" button is also there, use code like this for the "OK" button's "click":The "g:form-data" iterates the gui you give it, and looks for children with a "name". Those it grabs the text from and from the lot it creates an object:So after "g:form-data" you get an object whose keys are the names of the form's controls, and whose values are the text associated with those controls.NB: yes, thank you. I noticed that "combo" controls don't react to the "g:text?", and that has been fixed for the next release...