cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

Discussions

Solve problems, and share tips and tricks with other JMP users.
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!

Recommended Articles