Clear ListBrowser

This forum is for general developer support questions.

Clear ListBrowser

Postby mritter0 » Thu Oct 29, 2015 2:55 am

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.
Workbench Explorer - A better way to browse drawers
User avatar
mritter0
 
Posts: 212
Joined: Mon Aug 25, 2014 10:41 pm
Location: Bettendorf, IA, USA

Re: Clear ListBrowser

Postby tonyw » Thu Oct 29, 2015 4:33 am

Without reading the docs, I would guess something like:

Disconnect list
Refresh

or

Disconnect List
Reconnect blank list
Refresh
cheers
tony
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 1315
Joined: Wed Mar 09, 2011 2:36 pm
Location: Sydney, Australia

Re: Clear ListBrowser

Postby broadblues » Thu Oct 29, 2015 4:39 pm

mritter0 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.


The process should be

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);


You *could* call RefreshSetGadgetAttrs() when removing the list instead of SetAttrs ot StetGadgetsAttrs() but only do that when you *know* your list must be empty for a while and your not simply exchnaging data sets.

Make sure your window pointer is valid before calling that, and NULL is not okay.
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 538
Joined: Sat Jun 18, 2011 3:40 am
Location: Portsmouth, UK


Return to General Developer Support

Who is online

Users browsing this forum: No registered users and 4 guests