We’re asking you to select a content label when starting a new topic in the Discussions area. Read more to find out why.
Choose Language Hide Translation Bar
Highlighted
agonzales2021
Level III

Refreshing items in text edit box, text box, or list box (whichever is easiest)

Ughh the last thing I get held up on is refreshing :/

 

Okay. So I have the option of having a list box or text edit box (I hate text boxes since you can't hilight text in them) that by default contains only one line "Existing comments go here"

 

And when a user presses a button below, a function is run that feeds back a list "All_Comments" = {"A", "B"};
I'd like to replace that "Existing comments go here" in the box I use with the items from my list. :) Unfortunately, nothing I am trying is working.

I've tried refreshing, reshowing, appending... maybe I'm not going it right. Here is a simple example I can learn from:

disp = {"INSERT HERE"};

nw1 = New Window("NEW STUFF",
lb= List Box(disp)

);


All_Comments={"SOAP","FOOD","PUPPIES"};
lb << Append( List box(All_Comments));

2 REPLIES 2
Highlighted
ian_jmp
Staff

Re: Refreshing items in text edit box, text box, or list box (whichever is easiest)

Is this it?

NamesDefaultToHere(1);
disp = {"INSERT HERE"};
nw1 = New Window( "NEW STUFF",
		lb = List Box( disp ),
		ButtonBox("Update List", updateScript);
		);
ShowProperties(lb);

updateScript =
Expr(
	All_Comments = {"SOAP", "FOOD", "PUPPIES"};
	lb << removeAll;
	lb << append(All_Comments)
);

Look in the log to see what other messages 'ListBox()' understands.

Highlighted
pmroz
Super User

Re: Refreshing items in text edit box, text box, or list box (whichever is easiest)

You can highlight text boxes by changing their background color.

nw = new window("Test",
	tb1 = text box("Hello"),
	tb2 = text box("World")
);

tb1 << Background Color( "Green" );
tb2 << Background Color( "Light Yellow" );

The method is there for text edit boxes too but doesn't seem to have any effect.