Statalist The Stata Listserver

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

st: Re: using dynamic_list_control class

From   "Sergiy Radyakin" <>
To   <>
Subject   st: Re: using dynamic_list_control class
Date   Thu, 15 Mar 2007 20:53:39 +0100

Hello Zurab,

I am using the file dynamic_list_control.class from Stata's base ADO directory as a hint on your question.
Notice comments



So if I wanted to add an item to a dynamic list I do it like this:, dialogname(mydlg2) controlname(tabby2.lb1)
.dlist.setList, newlist(`"`vars'"')

.mydlg2_dlg.Vars1.Arrpush "Something"
.mydlg2_dlg.tabby2.lb1.additem "Something"

.`.dlist.fullListReference'.Arrpush "Something2"
.`.dlist.fullObjectReference'.additem "Something2"

classutil drop .dlist

Notice that Vars1 is defined as a dummy list in the dialog file.
You can either address the list directly (as in "Something"), or refer to it's fields, containing the full references (as in "Something2").
.dlist.print will display the contents of these fields.

In short, the above code will create a dynamic list object with items from local macro vars, and then append two items to the end of the list.

Question to all dialog programmers. What references/tutorials on dialog programming and controls are available in the Internet? Google search yields hardly a handfull of links :(

Best Regards, Sergiy Radyakin

----- Original Message ----- From: "Zurab Sajaia" <>
To: "statalist" <>
Sent: Thursday, March 15, 2007 5:35 PM
Subject: st: using dynamic_list_control class

Dear all,

I'm building a dialog with dynamically changed content and based on earlier discussions on the Statalist came to use dynamic_list_control class.

James Hassell kindly showed how to set the list interactively, and now I'm trying to use other methods of the class, namely appending or deleting an item.

My problem is that whenever the new instant is created and linked to the listbox, contents of the list are cleared:

dlist = , dialogname(d1) controlname(main.lb_level)

.set method (which is called by .new) has "._clearList" at the end that clears the list. This was not an issue in the example given by James because he was then redefining the new list by:

.dlist.setList, newlist(`levels')

but if I need to add (or drop) one item only this seems to be a problem:
.dlist.appendItem, item("something") will result in list containing just "something".

I'd appreciate much any advice what to change (if Im doing something wrong)


* For searches and help try:
*   For searches and help try:

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