Is it possible to create a multiple columns in a single list box?<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />I have created a list box with 21 items in it as shown below
// Create dialog window that user selects Site ID of station
result = New Window( "Select Site ID",
<< Modal,
<< Return Result,
siteid = List Box(
{"CGE", "CH3", "CH14", "CH22", "CHO", "FCF", "FCO", "JUN", "MET", "MMF", "MMO", "SGF",
"SGO", "TRF", "TRO", "TNF_IR100", "WED", "UC_CH14", "UC_FCF", "UC_MMF", "UC_SGF",
"UC_TRF"},
nlines( 23 )
),
);
// Instruction needed to Return Result from List Box
siteid = result["siteid"];
// Extract value from list for use as variable
stn = siteid [ 1 ];
I'm wondering if there is a way to display the List items in 2 or more columns for the user to select? Such as,
CGE FCF MMF TRF UC_CH14
CH3 FCO MMO TRO UC_FCF
CH14 JUN SGF TNF_IR100 UC_MMF
CH22 MET SGO WED UC_SGF
UC_TRF
I've tried V List Box for the List Box but can't seem to figure if it's possible to do this, and if so, how it might be done. Any suggestions would be very appreciated
Re: Is it possible to create a multiple columns in a single list box?Brilliant effort. This is a really interesting solution. It's going to take some time to get my head around what you did. Thanks for the awesome first post!
Re: Is it possible to create a multiple columns in a single list box?
Thanks, I did try that, but I found it came out with a ridiculous amount of spaces between lines, I'll have to play with it a little more.
Re: Is it possible to create a multiple columns in a single list box?Nice work dkeshock! To maintain the syntax colorization and fonts, copy/paste the code from JMP to a Word document. They copy/paste it from Word to this forum.
Re: Is it possible to create a multiple columns in a single list box?I can't get columns in a list box but what about multiple list boxes, which you can only select one item for as below?
If you change the NoofCol it will change the output number of columns, but I don't have it working for multiple selections so MaxItems doesn't do anything yet. I apparently need to look up how to post while retaining the script colors...it's my first post.
ListBoxList = {"CGE", "CH3", "CH14", "CH22", "CHO", "FCF", "FCO", "JUN",
"MET", "MMF", "MMO", "SGF","SGO", "TRF", "TRO", "TNF_IR100", "WED",
"UC_CH14", "UC_FCF", "UC_MMF", "UC_SGF","UC_TRF"};
/* Number of desired Columns */
NoofCol = 5;
/* Maximum Items Selected - Not Implemented */
MaxItems = 1;
/*************************************************************/
ListItems = N Items(ListBoxList);
ItemsPerBox = Ceiling(ListItems / NoofCol);
MaxLength = 0;
For(i=1, i<=ListItems, i++,
If(Length(ListBoxList) >= MaxLength,
MaxLength = Length(ListBoxList),
empty(),
);
);
MaxLength = (MaxLength) * 7.5;
ListofLists = List();
ListofListBoxes = List();
ListCounter = 0;
FinalBox = Line up Box(N Col(NoofCol),);
/* List of Lists and of List boxes*/
For(i=1, i<= NoofCol, i++,
Eval(Parse(Eval Insert("\[
ItemList^i^ = List();
ListofLists[^i^] = ItemList^i^;
]\")));
For(j=1, j<=ItemsperBox, j++,
ListCounter = ListCounter +1;
If(ListCounter <= ListItems,
Eval(Parse(Eval Insert("\[
ItemList^i^[^j^] = ListBoxList[ListCounter];
]\"))),
empty(),
);
);
Eval(Parse(Eval Insert("\[
ListBox^i^ = List Box(ItemList^i^, Width(^MaxLength^), Nlines(^ItemsPerBox^), max Selected(^MaxItems^),
/* List Box Script */
SelectedParameter = ListBox^i^< SelectedParameter = SelectedParameter[1];
ActiveList = ListBox^i^;
For(k=1,k<=NoofCol, k++,
If(ListofListBoxes== ActiveList,
empty(),
ListofListBoxes< );
);
);
ListofListBoxes[^i^] = ListBox^i^;
FinalBox< ]\")));
);
New Window("TEST", < V List Box(
FinalBox,
H List Box(
Button Box("OK",
Selected = SelectedParameter;
),
Button Box("Cancel",
),
),
),
);
Re: Is it possible to create a multiple columns in a single list box?Yes,
I only want one selection at a time. So, the Combo Box will definitely reduce the clutter/length of my previous List Box. I still wonder if it's possible to create a multiple column List Box though, just in case.
Re: Is it possible to create a multiple columns in a single list box?Hello,
Do you want to limit the user response to one selection at a time?
If so, you could change from a list box to a combo box.
Cheers,
Stan
// Create dialog window that user selects Site ID of station
result = New Window( "Select Site ID",
<< Modal,
<< Return Result,
siteid = Combo Box(
{"CGE", "CH3", "CH14", "CH22", "CHO", "FCF", "FCO", "JUN", "MET", "MMF", "MMO", "SGF",
"SGO", "TRF", "TRO", "TNF_IR100", "WED", "UC_CH14", "UC_FCF", "UC_MMF", "UC_SGF",
"UC_TRF"},
nlines( 23 )
),
);
