# Output to scrollField in GUI

**URL:** https://forum.highend3d.com/t/output-to-scrollfield-in-gui/5499
**Category:** Maya
**Tags:** mel
**Created:** [February 24, 2003, 5:30pm UTC](https://forum.highend3d.com/t/output-to-scrollfield-in-gui/5499 "2003-02-24T17:30:23Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![geoffcrowther](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/g/5daacb/32.png) [@geoffcrowther](https://forum.highend3d.com/u/geoffcrowther)
#### Post date: [February 24, 2003, 5:30pm UTC](https://forum.highend3d.com/t/output-to-scrollfield-in-gui/5499/1 "2003-02-24T17:30:23Z")

</div>

does anyone know why the values in an array will not output to a `scrollField` in a mel GUI?

If I use the print command on the array variable all of the stored values print to the script window fine, but if the variable is passed onto a scrollField command using -text $text, it only shows the first value of the array.

thanks

Geoff

---

<div class="post-metadata">

### Author: ![warpcat](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/w/c89c15/32.png) [@warpcat](https://forum.highend3d.com/u/warpcat)
#### Post date: [February 24, 2003, 7:09pm UTC](https://forum.highend3d.com/t/output-to-scrollfield-in-gui/5499/2 "2003-02-24T19:09:31Z")

</div>

I'm just trying to remember off the top of my head, but I recal that for each element in your array, you need to assign it to a new line in the scrollField. This is easily done with a loop.

---

<div class="post-metadata">

### Author: ![geoffcrowther](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/g/5daacb/32.png) [@geoffcrowther](https://forum.highend3d.com/u/geoffcrowther)
#### Post date: [February 25, 2003, 10:51am UTC](https://forum.highend3d.com/t/output-to-scrollfield-in-gui/5499/3 "2003-02-25T10:51:25Z")

</div>

thanks for the tip - I'm trying it out now, but without success - can't get the scrollfield to update - I'm getting the last iteration of the array to show instead of the first. If you've got time please have a look at my attempt and pick it to pieces:

this is the loop ($text is the array, $scrolltext is the variable I'm trying to feed into the scrollField)  
string $scrolltext;  
int $a;  
for ($a = 0; $a \< (size($text)); $a++)

{  
$scrolltext = $text[$a];  
}

and then fed into scrollField (i'm using formlayout so the scrollField is defined as a variable first before being attached to the form):

string $textfield = `scrollField -text $scrolltext`;

---

<div class="post-metadata">

### Author: ![gdc](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/g/898d66/32.png) [@gdc](https://forum.highend3d.com/u/gdc)
#### Post date: [February 25, 2003, 5:06pm UTC](https://forum.highend3d.com/t/output-to-scrollfield-in-gui/5499/4 "2003-02-25T17:06:18Z")

</div>

you need to either build up one string that you add to the scrollField with the -text flag or append to the text in thescrollField with the -it flag.

// build one long sting method...  
string $scrollText;  
for($a=0;$a \< size($text);$a++)  
{  
 $scrollText=($scrollText+$text[$a]+"n");  
}  
string $textfield=`scrollField -text $scrollText`;

OR  
string $textfiled=`scrollField myscrollfield`;  
for($a=0;$a \< size($text);$a++)  
{  
 scrollField -e -it $text[$a] myscrollfield;  
}

I haven't really tested this, but it should at leaste get you going in the right direction.  
--g

---

<div class="post-metadata">

### Author: ![geoffcrowther](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/g/5daacb/32.png) [@geoffcrowther](https://forum.highend3d.com/u/geoffcrowther)
#### Post date: [February 25, 2003, 9:39pm UTC](https://forum.highend3d.com/t/output-to-scrollfield-in-gui/5499/5 "2003-02-25T21:39:02Z")

</div>

GDC - you are an utter Genius!!!!!!!! thankyou -I've been messing with this for a day without luck and you've fixed it for me in minutes - thanks.

---

<div class="post-metadata">

### Author: ![gdc](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/g/898d66/32.png) [@gdc](https://forum.highend3d.com/u/gdc)
#### Post date: [February 26, 2003, 12:20am UTC](https://forum.highend3d.com/t/output-to-scrollfield-in-gui/5499/6 "2003-02-26T00:20:08Z")

</div>

your welcome.  
Glad to hear it worked!  
--g
