I am not seeing an easy way to clear (remove all text from) a listbrowser. Detaching the list does not clear it. IListBrowser->FreeListBrowserList(lblist2); does not clear it.
The issue I have is my listbrowser ColumnInfo will vary in number of columns depending on what the user is currently doing. So adding back a blank list could be tedious. And more work to then detach that list, clear it, add new real list.
Is there an easy way to detach the list, wipe the gadget display area clean, do some stuff, add a new list when ready?
ClearListBrowserDisplayArea() would be a nice addition.
Clear ListBrowser
Clear ListBrowser
Workbench Explorer - A better way to browse drawers
- tonyw
- AmigaOS Core Developer
- Posts: 1479
- Joined: Wed Mar 09, 2011 1:36 pm
- Location: Sydney, Australia
Re: Clear ListBrowser
Without reading the docs, I would guess something like:
Disconnect list
Refresh
or
Disconnect List
Reconnect blank list
Refresh
Disconnect list
Refresh
or
Disconnect List
Reconnect blank list
Refresh
cheers
tony
tony
- broadblues
- AmigaOS Core Developer
- Posts: 600
- Joined: Sat Jun 18, 2011 2:40 am
- Location: Portsmouth, UK
- Contact:
Re: Clear ListBrowser
The process should bemritter0 wrote:I am not seeing an easy way to clear (remove all text from) a listbrowser. Detaching the list does not clear it. IListBrowser->FreeListBrowserList(lblist2); does not clear it.
The issue I have is my listbrowser ColumnInfo will vary in number of columns depending on what the user is currently doing. So adding back a blank list could be tedious. And more work to then detach that list, clear it, add new real list.
Is there an easy way to detach the list, wipe the gadget display area clean, do some stuff, add a new list when ready?
ClearListBrowserDisplayArea() would be a nice addition.
Create List
Attach
Refresh (sometime rethink window if layout will chnage)
Detach List
Modify
Reattach List
Refresh (or rethink if list browser may chnage size)
There no need to clear the listbrower whilst modifyig the list. You don;t want it to flicker, just smoothly update from on set of data to the other.
Ofcourse if there is an extended period when you want to display nothing, (no disks inserted for example based on one of your other questions ) you can either not reattach the list before refreshing or attach an empty list and refresh.
eg:
Code: Select all
ObtainSemaphore(mv->mv_FileListSema);
SetAttrs(mv->mv_Gadgets[MV_GAD_FILELISTER],LISTBROWSER_Labels,NULL,TAG_DONE);
/*
Lots of stuff here that chnages the detached list, perhaps even clears it.
*/
SetAttrs(mv->mv_Gadgets[MV_GAD_FILELISTER],LISTBROWSER_Labels,&mv->mv_FileList,TAG_DONE);
if(mv->mv_Gadgets[MV_GAD_FILELISTER])
{
SelectNodeAndMakeVisible(mv->mv_Gadgets[MV_GAD_FILELISTER],mv->mv_Window,NULL,(struct Node *)dtd->dtd_CurrentFile);
if(mv->mv_Window)
{
RefreshGList(mv->mv_Gadgets[MV_GAD_FILELISTER],mv->mv_Window,NULL,1);
}
}
ReleaseSemaphore(mv->mv_FileListSema);
Make sure your window pointer is valid before calling that, and NULL is not okay.