Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Re: Re: dialog programming


From   Tim Hofer <[email protected]>
To   [email protected]
Subject   Re: st: Re: Re: dialog programming
Date   Fri, 05 Dec 2003 12:36:20 -0500

I'm not sure if this is what you want but check out this thread

http://www.stata.com/statalist/archive/2003-03/msg00070.html

using that as a model I wrote a dialog box/ program where values of spinners

SPINNER sp_q1_r1 @ spyincr splen ., ///
label("Spinner one") ///
min(0) max(1000) default(30) ///
onchange("program spq1_chg")
....

if changed, call a program at the bottom of the dialog file

PROGRAM spq1_chg
BEGIN
put "prspin 1 " main.sp_q1_r1 " " main.sp_q1_r2 " " main.sp_q1_r3 " " ///
" " main.sp_q1_r4 " " main.sp_q1_r5 " " main.sp_q1_r6 " "
stata
END

which then builds a command line and invoke stata to run an ado file called - prspin.ado

the ado file does some calculations and then returns a value into 1 of the six spinners
with this statement

.prevrev_dlg.main.sp_q1_r6.setvalue "`val'"
(using the class system to set a label or value in this case)


a pretty specific operation but it might be generalizable to what you are interested in.



Steichen wrote:


James Hassell (one of the StataCorp dialog gurus) replied:




Sophie originally wrote:


I am currently working on a dialog program which is meant to have a
different dialog depending on the number of groups entered in the first
window. I.e. if the use enters 2 groups in the main window, then he will
find two boxes to enter a value in on the options window, and if he

enters 4


groups initially, then he will find 4 boxes etc. is there a way to

program


this?

And Thomas Steichen followed up with:



If you have a small set of possible groups sizes, small enough so that

you


can choose among them with a radio control, then what you want to do can

be


done easily. But, I am fairly certain there is not an _easy_ way to

capture


the numeric value of a control and use it to modify the appearance of a
dialog window.

Thomas is exactly right. There is not a method built into the Stata
dialog language for passing information between two dialog windows.
Thomas also suggested letting the user specify the desired number of
groups with RADIO buttons. This is a good solution which could possibly
be enhanced by using a COMBOBOX or LISTBOX. The general idea is to force
the user to specify how many groups are expected. With this information,
the event handlers for that control, can show and hide additional EDIT
boxes or other controls located on the same tab or even other tabs.
However, they cannot control other dialog box windows.

Sophie did contact Stata technical support and has been provided with
the information above. I thought others might be interested, so I decided
to post a follow up here.

James,

You left out the other part of my answer... where I suspected that it might
be doable "by
invoking an .ado and/or by using some of the non-public features of the
dialog language."

So, I'll ask directly: Is it possible to capture the numeric value of one
control then use it to manipulate the event handlers for other controls?

Tom


*
* 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/


*
*   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