列表框忽略列表中的重复项!!大家好,下面是简单的代码,我使用列表框打印两个列表。在列表“Perf_cal”中,第2和第3项是相同的。因此,当我在jsl以下运行时,只有第2或第3项与其他项目一起打印。我需要的是打印列表中的所有项目(在这种情况下为8),而不删除任何重复项。
谢谢
newwindow("new",
Perf_cal = {"101.6", "100.8", "100.8", "100.2", "101", "101.8", "100", "99.2"};
Perf_item = {"a", "b", "c", "d", "e", "f", "g", "h"};
perf=hlistbox(listbox(Perf_item,width(20),nlines(8)), listbox(Perf_cal,width(50),nlines(8)));
);Re:列表框忽略列表中的重复项!!您可以做的另一种方法是通过在其前面加上perf_item来使perf_cal唯一。 当用户进行选择时,您需要去掉前三个字符。
Perf_cal = {"101.6", "100.8", "100.8", "100.2", "101", "101.8", "100", "99.2"};
Perf_item = {"a", "b", "c", "d", "e", "f", "g", "h"};
perf_list = {};
for (i = 1, i <= nitems(perf_cal), i++,
perf_list[i] = perf_item[i] || ". " || perf_cal[i];
);
New Window( "new",
perf = H List Box(
List Box( Perf_list, width( 50 ), nlines( 8 ) )
);
);Re:列表框忽略列表中的重复项!!表格框和<< Set Selectable Rows消息允许您选择单个项目。 根据您是否要一起选择项目和cal,以下是构建窗口的两种方法:

Names Default to Here( 1 );
Perf_cal = {"101.6", "100.8", "100.8", "100.2", "101", "101.8", "100", "99.2"};
Perf_item = {"a", "b", "c", "d", "e", "f", "g", "h"};
New window("new",
H List Box(
tb1 = Table box(
String Col Box( "Item", Perf_item ),
String Col Box( "Cal", Perf_cal )
),
spacerbox( size( 10, 10 ) ),
tb2 = Table box(
String Col Box( "Item", Perf_item )
),
tb3 = Table box(
String Col Box( "Cal", Perf_cal )
),
<<PADDING></PADDING>
Re:列表框忽略列表中的重复项!!好吧,要使用字符串col框,表框是没有必要的。我没有使用字符串col盒,bcoz,个别项目是不可选择的。但是谢谢你看看它。Re:列表框忽略列表中的重复项!!我不确定具体的列表框问题,但我想知道一个表格框是否能实现你的目标。
Perf_cal = {"101.6", "100.8", "100.8", "100.2", "101", "101.8", "100", "99.2"};
Perf_item = {"a", "b", "c", "d", "e", "f", "g", "h"};
New window("new",
tb = Table box(
String Col Box( "Item", Perf_item ),
String Col Box( "Cal", Perf_cal )
)
);
tb << Set Selectable Rows( 1 );
tb << Get Selected Rows;