Subscribe Bookmark RSS Feed

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

agonzales2021

Contributor

Joined:

Jun 23, 2017

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
ian_jmp

Staff

Joined:

Jun 23, 2011

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

Joined:

Jun 23, 2011

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.