List View Help
4 messages in this thread
Does anyone know if the list in a list view gadget can be updated ? I
can add to the list used when the gadget was created but the gadget (after
RemoveGadget(),alter list,AddGadget(),RefreshGadgets() ) only displays the same
number of elements as when it was created. Is there a number of elements field
somewhere that can be altered ?
Any help is much appreciated.
Nev.
Nevil,
Remove the list …
GT_SetGadgetAttrs(lv, lv_window, NULL, GTLV_Labels, ~0, TAG_DONE);
delete the element from your list …
(cd = number of entry in the list to remove)
i = 0;
node = NameList->lh_Head;
while (node) {
if (i == cd) {
Remove(node); // remove entry from list view
break;
}
i++;
node = node->ln_Succ;
}
reattach list …
GT_SetGadgetAttrs(lv, lv_window, NULL, GTLV_Labels, NameList,
GTLV_Selected, 0, TAG_DONE);
Simple.
-sja
Simple when you know how! Many thanks.
Nev.
The way to update a listview is to detach the list, alter it, then
re-attach the list.
/* Detach list by setting labels to ~0 */
GT_SetGadgetAttrs( Gadgets_ptr, Wnd_ptr, NULL
, GTLV_Labels, ~0
, TAG_DONE);
/*
* Add/delete nodes here.
*/
/* Re-attach list. */
GT_SetGadgetAttrs( Gadgets_ptr, Wnd_ptr, NULL
, GTLV_Labels, list_ptr
, TAG_DONE);
//
\X/ Amiga or bust! Gary Bonnstetter, Bonnsoft