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

Re: st: Dialogs setvalue and tab switching

From (James Hassell, StataCorp)
Subject   Re: st: Dialogs setvalue and tab switching
Date   Mon, 27 Aug 2007 12:11:08 -0500

Sergiy Radyakin <> has asked several questions about
dialog programing and various behavior of the dialog system.  I will
respond below.  If Sergiy has more in-depth questions he would like to
ask, I invite him to email me privately at

> 1. I have a dialog with a combobox (COMBOBOX control) and a label
> (TEXT control). I would like to set the label to be equal to some text
> and the value of the combobox. To do this I handle onselchange()
> event:

> PROGRAM Combo_changed
>   put  `".my_dlg.main.tx_key.setlabel "My string "' main.cb_box1 `"""'
>   stata hidden

> I wonder if I can achieve the same result without having to call Stata
> from my dialog.
> If I write:

> PROGRAM Combo_changed
>   call main.tx_key.setlabel main.cb_box1
> the label becomes "main.cb_box1" (e.g. it is not evaluated). However,
> the same expression is evaluated in the -put- statement. I wonder if
> it was possible to manipulate the values of controls in the dialogs
> too.

Sergiy can write a dialog PROGRAM to handle the task without calling the 
Stata ado engine.

You can use an undocumented feature: withvalue. 

withvalue is used as a member program and takes the -value- of a dialog
control and places it in a substitution character '@'. This method will
work in both Stata 9 and Stata 10.

SCRIPT Combo_changed
	main.cb_box1.withvalue main.tx_key.setlabel "@"

> 2. Working on a computer without a mouse recently I noticed that
> Ctrl+PgUp and Ctrl+PgDn combinations, which switch the tabs of a
> dialog, do not work in Stata (versions 8, 9 and 10 for Windows). Can
> this be fixed? Is there any other shortcut to switch tabs?

We will work to get this added, but I can't give a time frame on when
it will be done.

> 3. Regarding tabs. There seems to be a differential behaviour between
> the versions of Stata. At least in version 8 (Windows) focused
> controls were highlighted (with a dotted line). Already in version 9
> (Windows) it disappeared (though I guess it was retained in v9 some
> time ago). Thus having 10 checkboxes on a form makes it difficult to
> realize which one is active (again, no mouse). Can this highlighting
> feature be controlled somehow? E.g. version control/dialog
> directive/scheme, etc. Does XP Scheme has anything to do with it?

The Windows DLL (uxtheme.dll) which controls the appearance of themes
seems to be preventing the focus rings from appearing.  We have been
unable to find a workaround we can implement in the code.  However,
end users can work around this by enabling "Show extra keyboard help
in programs" under the "Accessibility Options" in Windows XP, and
keyboard focus rings should return.

> And how is tab-ordering of controls organized? (e.g. in the same
> sequence the controls are defined in the file, or top-to-bottom/ then
> left-to-right, or something else?)

This is normally the order in which the controls are created.  However,
the behavior is operating system and window manager dependent.

*   For searches and help try:

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