[S] Those pesky dialogue boxes (long)

Frank Biedermann (frank@ssabsa.sa.gov.au)
Thu, 26 Mar 1998 11:47:15 +-10-30

Sorry about the new subject line - I accidentally deleted the previous message
about dialogue boxes in Splus 4.0r3 on a win95 machine.

I too had a similar problem to that the author of the aforementioned post is
having. His problem was: entering a numeric value in a string box results in the
error message:

Error: Left side of assignment can't be of mode numeric

The dialogues that I wrote recently came up with the same error message, but
I'm not convinced that entering numeric values in string controls is the problem.
I think that it's trying to coerce a character string to be of mode numeric (it is after
all complaining that the LHS is numeric), and it subsequently collapses in a heap.

Controls I used on the dialogue boxes I was having problems with were strings,
listboxes and buttons, however, I seemed to be able to enter numeric values in these
without any problems (cbGetCurrValue returned the numeric value converted into a
string). The point when the callback functions exit, however, was when the above
error rears its ugly head (I used browser() a lot in the callback functions before I
found this out).

Another problem I found with the dialogue boxes was with child dialogue boxes.
I created a child dialogue box to receive a username, password, and datasource
name for an SQL query and when ok was pushed the callback function copied
these values to some invisible controls on the parent dialogue box using
guiModifyDialog as per the sample script (so that the password didn't stay visible
for long - I can't seem to make the string control use masking characters like you
can with the editfield control but that's another issue). The problem I had was that
guiModifyDialog copied the datasource and username values properly, but only
copied the password value around half the time (it seemed to only copy it when
I clicked on the ok button with the mouse, but not when I pressed enter). This
behaviour was both extremely weird (why copy 2/3 values only?) and extremely
frustrating also.

You'll note that all of the above is written in the past tense - the above problems
aren't happening any more. I went home after work last night extremely frustrated
with the problems, came in this morning and fired up Splus (hoping a new session
would help) but the same problems occurred. In desperation I did the following:

inspect(guiDisplayDialog("Function", Name = "fnSubject"))

which of course did not give me the information I thought it would because I wasn't
having problems with guiDisplayDialog, but it did miraculously cure both the LHS
can't be numeric, and the value copying problem. My dialogue boxes now seem
to work perfectly (with the exception of not being able to use password masking
characters in a string control). I don't know why this occurred, but it did.

Sorry if this doesn't help you, but I thought I'd relay my experiences with the
dialogue box.

PS For those of you who read my post from yesterday, and are still in the dark
about ODBC datasource names you can get them from the file:


I wrote a little function to retrieve the names, thus:

GetDSN _ function()
ODBC <- scan("c:\\windows\\odbc.ini", what = "", sep = "\n")
DSN <- ODBC[grep("*SQL Server (32 bit)", ODBC)]
substring(DSN, 1, regexpr("=", DSN) - 1)

However, I am still at a loss as to how to encrypt the ODBCConnection string...

Frank Biedermann
Research Officer (Statistics)
60 Greenhill Rd
Wayville SA 5034
email: frank@ssabsa.sa.gov.au
ph: (+61) 8 8372 7439
fax: (+61) 8 8372 7590

This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news