cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Andyon98
Level II

File selector

I am trying to create a small menu that allows you to choose open data tables. Once you highlight the files you want and press a "Add files" button it will expand the existing window in another box showing the file name and two other text boxes in which the user can type stuff into.

 

How can this be achieved?

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: File selector

Get list of the items from List Box and then loop over them while adding new boxes (or use table box). I cannot really give better advice as I have no real idea what I'm helping with.

 

Names Default To Here(1);

nw = New Window("Example",
	H List Box(
		V List Box(
			a = List Box({"single", "double", "triple"}),
			b = Button Box("Add Selections",
				selections = a << Get Selected;
				scb << Add Element(selections);
				sceb1 << Add Element(Repeat({""}, N Items(selections)));
				sceb2 << Add Element(Repeat({""}, N Items(selections)));				
			)
		),
		tb = Table Box(
			scb = String Col Box("Option", {}),
			sceb1 = String Col Edit Box("Edit1", {}),
			sceb2 = String Col Edit Box("Edit2", {})
		)
	)
);
-Jarmo

View solution in original post

4 REPLIES 4
jthi
Super User

Re: File selector

 You can get list of open datatables with << get data table list(), and you can combine that with << Get name to get names of those. List Box allows you to create selector for those based on the name list.

Names Default To Here(1);
Open("$SAMPLE_DATA/Big Class.jmp");
Open("$SAMPLE_DATA/Cars.jmp");
Get Data Table List() << get name;

For the "expand existing window" you can use << append with text edit boxes to allow user to type into or maybe Table Box with String Col Edit Box.

-Jarmo
Andyon98
Level II

Re: File selector

I’ve got something now but im finding it difficult to select multiple files and create another box for each one instead of creating only one box for > 1 chosen file.
jthi
Super User

Re: File selector

Get list of the items from List Box and then loop over them while adding new boxes (or use table box). I cannot really give better advice as I have no real idea what I'm helping with.

 

Names Default To Here(1);

nw = New Window("Example",
	H List Box(
		V List Box(
			a = List Box({"single", "double", "triple"}),
			b = Button Box("Add Selections",
				selections = a << Get Selected;
				scb << Add Element(selections);
				sceb1 << Add Element(Repeat({""}, N Items(selections)));
				sceb2 << Add Element(Repeat({""}, N Items(selections)));				
			)
		),
		tb = Table Box(
			scb = String Col Box("Option", {}),
			sceb1 = String Col Edit Box("Edit1", {}),
			sceb2 = String Col Edit Box("Edit2", {})
		)
	)
);
-Jarmo
Andyon98
Level II

Re: File selector

That's no problem, thank you so much for your help!