cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
pauldeen
Level VI

Delete a text box and a button from a lineup box

I'm trying to delete both the button itself and the associated text box before it. So when I cilck button nr 3 I want text nr 3 to also be deleted. Any ideas?

 

nr=5;
new window("Button test",
	Lineuplist=Lineup Box( N Col( 2 ),
		
	)
);
For(i=1,i<=nr,i++,
	Lineuplist << append(textbox("Text nr "||char(i)));
	Lineuplist << append(
		buttonbox("Button nr "||char(i),
			<< Set Function(
				Function({this},
					this << delete;
				)
			)
		);
	);
);
1 ACCEPTED SOLUTION

Accepted Solutions
thomasz
Level IV

Re: Delete a text box and a button from a lineup box

Here is a piece of code that works:

nr=5;
new window("Button test",
	Lineuplist=Lineup Box( N Col( 2 ),
		
	)
);
For(i=1,i<=nr,i++,
	Lineuplist << append(textbox("Text nr "||char(i)));
	Lineuplist << append(
		buttonbox("Button nr "||char(i),
			<< Set Function(
				Function({this},
					ps=this<<sib;
					par=this<<parent;
					buttonName=this<<get button name;
					buttonNo=regex(buttonName,".*?([0-9]*)$","\1");
					locator=eval insert("//TextBox[text()='Text nr ^buttonNo^']");
					textBox=par<<xpath(locator);
					textBox<<delete;
					this<<delete;
				)
			)
		);
	);
);

View solution in original post

3 REPLIES 3
uday_guntupalli
Level VIII

Re: Delete a text box and a button from a lineup box

@pauldeen

nr=5;
new window("Button test",
	Lineuplist=Lineup Box( N Col( 2 ))
	      ); 
);
For(i=1,i<=nr,i++,
	Lineuplist << append(textbox("Text nr "||char(i)));
	Lineuplist << append(
		buttonbox("Button nr "||char(i),
			<< Set Function(
				Function({this},
					this << delete;
				)
			)
		);
	);
	Lineuplist[Text Box(i)] << delete ; // this is the piece of code which will do what you are after . Insert it where you delete the button 
);
Best
Uday
thomasz
Level IV

Re: Delete a text box and a button from a lineup box

Here is a piece of code that works:

nr=5;
new window("Button test",
	Lineuplist=Lineup Box( N Col( 2 ),
		
	)
);
For(i=1,i<=nr,i++,
	Lineuplist << append(textbox("Text nr "||char(i)));
	Lineuplist << append(
		buttonbox("Button nr "||char(i),
			<< Set Function(
				Function({this},
					ps=this<<sib;
					par=this<<parent;
					buttonName=this<<get button name;
					buttonNo=regex(buttonName,".*?([0-9]*)$","\1");
					locator=eval insert("//TextBox[text()='Text nr ^buttonNo^']");
					textBox=par<<xpath(locator);
					textBox<<delete;
					this<<delete;
				)
			)
		);
	);
);
pauldeen
Level VI

Re: Delete a text box and a button from a lineup box

Thanks!