To S+ Group:
My original problem was to take text items from 4 different dialog boxes,
either all 4 at once or one by one, and pass those names to a data.frame().
The consensus is to use the callback function. Using cbGetCurrValue() and
cbGetOptionList() grabs data from the dialog boxes. Be careful about including
quotes and/or commas in the list returned from the dialog box with useQuotes=T.
Also, I was unaware of the ..n feature using formal input (...), this gives
you access to the nth arg in the input.
This code is the usage of cbGetActiveProp() from the dialog example
'dlgcomm.ssc'. That and Widgets.ssc are two very handy examples. If Widgets
would take input and assign the inputs to variables it would be a perfect
dialog example showing an abundance of dialog features.
cbParentDlg <-function(df)
{if( ! IsInitDialogMessage(df) && (cbGetActiveProp(df) == "parentButton") )
{ guiModify( "Property", Name= "childParentId",
DialogControl= "Invisible", DefaultValue=cbGetDialogId(df) );
guiDisplayDialog("Function", "childDlg", T);
}
dfParentTemp <<- df
df}
Thanks again to Stephen Weller, Jean-Paul Fox and David Lorenz, but especially
to Truc-Giang because this also works perfectly:
TESTGui_function(arg1, arg2, arg3, arg4){
from.wide.MS.list<<-unlist(arg1)
from.wide.MS.list2<<-arg2
from.string.box<<-unlist(arg3)
from.radio.buttons<<-arg4
invisible(from.radio.buttons)
}
############################################################################
You will need to use what is called a dialog 'callback function' to update
and retrieve information from an active dialog. Take a look at the
'dlgcomm.ssc' Splus sample script in your '<SHOME>\samples\dialogs'
directory. Also check out the discussion in Chapter 17 of the
S-PLUS Programmer's Guide: Extending the Graphical User Interface.
Yes, you will need to use a separate callback function for each dialog. You
can grab the names selected in each dialog using the functions
'cbGetCurrValue()' and 'cbGetOptionList()'. Take a look at the 'dlgcomm.ssc'
example.
Stephen Weller
###########################################################
>guiCreate("FunctionInfo",Function="TESTGui",PropertyList =
> c("TESTProp0",
> "TESTPage1", "TESTPage2"))
This creates a dialog with two pages, but variables within these pages are
not defined. So define:
guiCreate("Property", Name = .... ) you can define the variables, names if
it is a string or a checkbox, see chapter 17 Pragrammer's Guide.
With the following command
guiCreate("Property", Name="TESTPage1", Type="Page",
PropertyList="variable names" ....)
one can point variables to TESTPage1 of the dialog.
The input variables must also be defined within the
guiCreate("Functioninfo", ......,.....,....
Argumentlist="#0=input1,
#1=input2,
#2=input3,
#3=input4,
#4=input5")
Then, the input of the dialog is defined and one can define a function,
TESTGui to perform some operation with this input.
Jean-Paul Fox.
Phillip,
The output from MS List Boxes is a comma separated string, if UseQuotes
is T in the property definition. You can use unlist(unpaste(output, sep
=",") to create a vector from one of the input boxes.
I also think that you should name your input into TESTgui. It is not
easy to deal with dots. Each unmatched argument (in ...) can be referred
to in the form ..n, where n is an integer identifying the sequential
argument in ... . So ..1 refers to the first argument in ... .
Dave
David Lorenz
|