[comp.sys.next] 2.0 Programming Question -- PopUpLists

john@csrnxt1.ae.utexas.edu (John R. Schutz) (06/17/91)

Please excuse the ignorant question, but hey, I'm learning.

Anyways, I am working on a program that has these popup's in a panel.
When a certain item is selected, it causes another panel to popup
which reads a number from the user.  When they are done entering the
number, I would like to add the number entered as the next to bottom
item in the popup list.

There are three of the popups, and I would rather not have to have
outlets to all three, and just use the sender.  The sender turns out
to be a matrix, but I just can't seem to get things to work right.

Any code for adding an item in a popup list for which you only have
the matrix?

							john
--
| John R. Schutz                     | Email&NeXTmail:                       |
| A learning NeXTie                  |		john@csrnxt1.ae.utexas.edu   |
| (512)328-0587                      | The 23rd periodic element is Vanadium |
| 3009 Hatley Dr., Austin, TX  78746 | 'V'.  V is roman numeral for 5. Hmmm  |

eps@toaster.SFSU.EDU (Eric P. Scott) (06/18/91)

In article <john.677174899@csrnxt1.ae.utexas.edu>
	john@csrnxt1.ae.utexas.edu (John R. Schutz) writes:
>Any code for adding an item in a popup list for which you only have
>the matrix?

    int rows, cols;
    char *string;

    [[sender getNumRows:&rows numCols:&cols] addRow];
    [[sender cellAt:rows:0] setTitle:string];
    [sender sizeToFit];

should work (If I understand the question correctly).

					-=EPS=-

jinscore@Channel_Z (Jim Inscore) (06/22/91)

In article <john.677174899@csrnxt1.ae.utexas.edu> john@csrnxt1.ae.utexas.edu  
(John R. Schutz) writes:
> There are three of the popups, and I would rather not have to have
> outlets to all three, and just use the sender.  The sender turns out
> to be a matrix, but I just can't seem to get things to work right.
> 
> Any code for adding an item in a popup list for which you only have
> the matrix?

The message:

[sender window] 

returns the id of the PopUpList (it works because Matrix inherits from View and  
PopUpList inherits from Window).  You could, for example, use

[[sender window] addItem:string]

to add a new item at the end of the list.

jinscore@next.com
NeXT Publications
|