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

From |
jhassell@stata.com (James Hassell, StataCorp) |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Stata 9 dialog problem with .iseq() |

Date |
Thu, 30 Aug 2007 17:24:33 -0500 |

Sergiy Radyakin <serjradyakin@gmail.com> has found a bug in the dialog system in Stata 9. The bug occurs when comparing a string control with a string literal using iseq(). The problem is triggered if the string literal contains a (.) dot. This bug has already been fixed in Stata 10, however Sergiy will need to code around this in Stata 9. He will be able to do this by using the _values_ list that can be associated with comboboxes, and then compare a string without the problematic dot. I have included a modified version of Sergiy's code below. /* test_combo.dlg (MODIFIED) */ 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) /// values(ls_combovalues2) /// onselchange("program combo_changed") dropdownlist END LIST ls_combovalues BEGIN "First" "Second" "Third" "Other..." END LIST ls_combovalues2 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 { if main.cb1.iseq("other") { /// put out Other... as a literal put `"di as result "' put `"""' "Other..." `"""' stata hidden stopbox note "We are OK" } if ! main.cb1.iseq("other") { put `"di as result ""' main.cb1 `"""' stata hidden } } END // -- EOF(test_combo.dlg) -- --James Hassell, StataCorp > 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? * * 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/

- Prev by Date:
**st: RE: about the return list of -codebook-** - Next by Date:
**Re: st: RE: about the return list of -codebook-** - Previous by thread:
**st: Stata 9 dialog problem with .iseq()** - Next by thread:
**st: Survey statistics, sampling methods** - Index(es):

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