CompuServe Thread

List View Help

4 messages in this thread
#42189From: Nevil UnderwoodAug 12, 1994 4:05 PM
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.
#42236From: Steve AhlstromAug 16, 1994 1:17 AM
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
#42260From: Nevil UnderwoodAug 17, 1994 2:45 PM
Simple when you know how! Many thanks. Nev.
#42291From: Gerald BonnstetterAug 19, 1994 6:28 AM
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