- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
select all items in list box with button?
Hi,
does anyone know a solution to select all items in a listbox with a [All] button?
New Window( "Select ONE Monthly ", <<Modal,
V List Box(
Text Box("ALL for Baseline"),
mon = List Box(:Stage << get values),
Button Box( "OK", cho = mon << get selected),
)
);
dt_data << Select Where(Contains(cho, :Stage));
Regards and thank you in advance,
Uwe
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: select all items in list box with button?
dt_data = Current Data Table();
mon_list = dt_data:Stage << get values;
New Window( "Select ONE Monthly ", << Modal,
V List Box(
Text Box( "ALL for Baseline" ),
mon = List Box(mon_list),
Button Box( "Select All",
For( i = 1, i <= N Items( mon_list ), i++,
mon << set selected( i )
)
),
Button Box( "OK", cho = mon << get selected ),
),
);
dt_data << Select Where( Contains( cho, :Stage ) );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: select all items in list box with button?
dt_data = Current Data Table();
mon_list = dt_data:Stage << get values;
New Window( "Select ONE Monthly ", << Modal,
V List Box(
Text Box( "ALL for Baseline" ),
mon = List Box(mon_list),
Button Box( "Select All",
For( i = 1, i <= N Items( mon_list ), i++,
mon << set selected( i )
)
),
Button Box( "OK", cho = mon << get selected ),
),
);
dt_data << Select Where( Contains( cho, :Stage ) );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: select all items in list box with button?
Thanks PMroz ... it works great :-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: select all items in list box with button?
There's a bug in my code if you have duplicates in the Stage column. A side effect of putting a list into a listbox is that it will only display unique values.
This code will fix that:
Get_unique_values = Function( {in_list}, {Default Local},
tmp = [=> 0];
Insert Into( tmp, in_list );
tmp << get keys;
);
dt_data = Current Data Table();
mon_list = get_unique_values( dt_data:Stage << get values );
New Window( "Select ONE Monthly ", <<Modal,
V List Box(
Text Box( "ALL for Baseline" ),
mon = List Box( mon_list ),
Button Box( "Select All",
For( i = 1, i <= N Items( mon_list ), i++,
mon << set selected( i )
)
),
Button Box( "OK", cho = mon << get selected ),
),
);
dt_data << Select Where( Contains( cho, :Stage ) );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: select all items in list box with button?
Hi Peter,
Thank you for fix it, but I didn't notice this problem or bug.
I have many duplicates in the column Stage, the Listbox displays only unique values.
How can I exclude a certain value like "Baseline"?
At best case, this should not appear in the listbox.
Regards
Uwe
Update:
mon_list = dt_data:Stage << get values;
for (j = N Items (mon_list), j > 0, j--,
if (mon_list
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: select all items in list box with button?
mon_list = get_unique_values( dt_data:Stage << get values );
bindex = contains(mon_list, "Baseline");
if (bindex > 0,
remove from(mon_list, bindex);
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: select all items in list box with button?
Hi Peter,
Thank you for the solutiuon.
Unfortunately it doesn't work for me, maybe it's up to v10
Regards,
Uwe