Amiga.org
Operating System Specific Discussions => Amiga OS => Amiga OS -- Development => Topic started by: jahc on April 25, 2003, 01:18:28 PM
-
I'm using MUIM_List_InsertSingle in a loop to write a list of stuff from a text file to a list view. It's just a one column no frills listview. I can see my new entries as its being added, but when its finished, if I try to select one, or scroll up and down the listview, the entries disapear. But the scrollbars stay small, as if there is something there. If I use the redraw command, everything disappears. If I use the MUIA_List_Quiet option, then it wont show the entries at all, even after setting it to FALSE and trying Redraw again..
Anyone think they know whats wrong?
-
Im guessing you have no construct/destruct hooks.
In this case you need to tell the listview to use
the built in ones:
MUIA_List_ConstructHook,
MUIV_List_ConstructHook_String,
MUIA_List_DestructHook,
MUIV_List_DestructHook_String
The built in one makes internal copies
of the strings so they dont dissapear.
-
Tried adding that, construct and destruct hooks... didnt affect the program.
Any other ideas? :)
-
Do you use a display-hook ?, in that
case the error could be there. Otherwise
paste a snippet of the code here and im sure me or someone will find what is wrong.
-
Here are the two important snippets from my program..
Object->LV_avail_binary_ng = ListviewObject,
MUIA_HelpNode, "LV_avail_binary_ng",
MUIA_List_ConstructHook,MUIV_List_ConstructHook_String,
MUIA_List_DestructHook,MUIV_List_DestructHook_String,
MUIA_FrameTitle, "Available Binaries",
MUIA_Listview_MultiSelect, MUIV_Listview_MultiSelect_Default,
MUIA_Listview_List, Object->LV_avail_binary_ng,
End;
nl_file.open ("progdir:a.txt",ifstream::in);
set2(app->LV_avail_binary_ng,MUIA_List_Quiet,TRUE);
while(nl_file.getline(ng2insert, 80, '\n'))
{
DoMethod(app->LV_avail_binary_ng, MUIM_List_InsertSingle, ng2insert, MUIV_List_Insert_Bottom);
}
set2(app->LV_avail_binary_ng,MUIA_List_Quiet,FALSE);
nl_file.close();
DoMethod(app->LV_avail_binary_ng,MUIM_List_Redraw,MUIV_List_Redraw_All);
-
Problem solved.
It WAS the destruct/construct hooks.. I was trying to add those hooks to the Listview object, instead of the List object. Duh!! :) Thanks for your help.
Object->LV_avail_binary_ng = ListObject,
MUIA_Frame, MUIV_Frame_String,
MUIA_List_ConstructHook,MUIV_List_ConstructHook_String,
MUIA_List_DestructHook,MUIV_List_DestructHook_String,
End;
Object->LV_avail_binary_ng = ListviewObject,
MUIA_HelpNode, "LV_avail_binary_ng",
//MUIA_List_ConstructHook,MUIV_List_ConstructHook_String,
//MUIA_List_DestructHook,MUIV_List_DestructHook_String,
MUIA_FrameTitle, "Available Binary Newsgroups",
MUIA_Listview_MultiSelect, MUIV_Listview_MultiSelect_Default,
MUIA_Listview_List, Object->LV_avail_binary_ng,
End;
There, that works much better.
-
Yep, thats it :)