Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Stata 9 dialog problem with .iseq()


From   "Sergiy Radyakin" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: Stata 9 dialog problem with .iseq()
Date   Thu, 30 Aug 2007 14:42:35 -0400

Hello Statalisters,

I am experiencing a problem with how the strings are handled in the
dialogs (Stata 9). The attached code makes the problem apparent.

To reproduce the problem:

1. save the file into test_combo.dlg
2. db test_combo
3. When any item is selected, its name appears in the Stata results window
4. When "Other" is selected, a message will pop-up "We are OK"
5. Now replace "Other" with "Other...". Notice that it must be changed 2 times.
6. discard
7. db test_combo
8. When any item is selected, its name appears in the Stata results window
9. When "Other" is selected,  the message DOES NOT pop-up.

The problem relates to using points in the values. I want to notify a
user that a new dialog window will open if a particular value is
selected among the choices (which is conventionally done by placing
"..." after it).

Is there any quick fix to it?

Best regards,
    Sergiy Radyakin



/*                test_combo.dlg                */

VERSION 9
SYNCHRONOUS_ONLY
POSITION 300 100 300 100

DIALOG main, label("Stata 9 combobox problem")
BEGIN
	COMBOBOX   cb1 30 10 100 ., contents(ls_combovalues)
onselchange("program combo_changed") dropdownlist
END

LIST  ls_combovalues
BEGIN
	"First"
	"Second"
	"Third"
	"Other"
END

SCRIPT PREINIT
BEGIN
	create BOOLEAN AfterInit
END

SCRIPT POSTINIT
BEGIN
	AfterInit.settrue
END

PROGRAM combo_changed
BEGIN
	if AfterInit {
	  put `"di as result ""' main.cb1 `"""'
	  stata hidden

	  if main.cb1.iseq("Other") {
	    stopbox note "We are OK"
	  }
        }
END

// -- EOF(test_combo.dlg) --
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index