LISTBROWSER_Top

This forum is for general developer support questions.

LISTBROWSER_Top

Postby mritter0 » Fri Apr 27, 2018 12:41 am

In my program Workbench Explorer sometimes I need to set the top item in the list. Normally when scan a drawer it is set to 0. But, say you have scrolled down 10 lines with the mouse wheel, then hit reload. I check what the _Top is first, rescan drawer, update the list (detach it, free old, build new), then attach it and set LISTBROWSER_Top, LBTop,. But it does not always work correctly. I can't figure out why.

This code works with 2 of the 4 situations I have.
Code: Select all
   ILayout->SetPageGadgetAttrs((struct Gadget *)Objects[GAD_CONTENT],Objects[GAD_CF_PAGES_CONTENT],MainWindow,NULL,
      LISTBROWSER_ColumnInfo,            WhichCI,
      LISTBROWSER_SortColumn,            SortColumn,
      LISTBROWSER_VertSeparators,         ShowVertSeparators,
      LISTBROWSER_AutoFit,            Prefs->AutoFitColumns,
      LISTBROWSER_Labels,               lblist2,
      LISTBROWSER_Top,               LBTop,
   TAG_DONE);


If I swap the last 2 lines, it works with 1 other but then first 2 no longer work. One situation never works. I know LBTop value is correct, I Printf() before attaching the list to see it.

I have played around with _Top and _Labels order, used SetAttrs() instead (yes, the gadget is on a page.gadget). LBTop will be set to 0, scan a drawer, but will start at the old LBTop spot. No rhyme or reason sometimes.

I would think you would set _Top first, then _Labels. Is there some magic order I am not doing? Does it even matter what order? Just baffling me.

listbrowser.gadget 53.74 (23.10.2016)
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: LISTBROWSER_Top

Postby broadblues » Fri Apr 27, 2018 2:08 am

Try calling RefreshPageGadget() after re-adding the list and setting LISTBROWSER_Top.

Always set LISTBROWSER_Top after adding the list, it's not meaningfull if no list is attached,

Possibly use a seperate call to SetPageGadgetAttrs.



Code: Select all
   ILayout->SetPageGadgetAttrs((struct Gadget *)Objects[GAD_CONTENT],Objects[GAD_CF_PAGES_CONTENT],MainWindow,NULL,
      LISTBROWSER_ColumnInfo,            WhichCI,
      LISTBROWSER_SortColumn,            SortColumn,
      LISTBROWSER_VertSeparators,         ShowVertSeparators,
      LISTBROWSER_AutoFit,            Prefs->AutoFitColumns,
      LISTBROWSER_Labels,               lblist2,
   TAG_DONE);

   ILayout->SetPageGadgetAttrs((struct Gadget *)Objects[GAD_CONTENT],Objects[GAD_CF_PAGES_CONTENT],MainWindow,NULL,
          LISTBROWSER_Top,               LBTop,
   TAG_DONE);

ILayout->RefreshPageGadget((struct Gadget *)Objects[GAD_CONTENT],Objects[GAD_CF_PAGES_CONTENT],MainWindow,NULL,;



Ought to give consistant results.


AS an aside do you really need to set all those other attrs when you reattache the list (fine if they have changed, but wasteful if they didn't);
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 538
Joined: Sat Jun 18, 2011 3:40 am
Location: Portsmouth, UK

Re: LISTBROWSER_Top

Postby mritter0 » Sat Apr 28, 2018 12:13 am

I made it work with the 2 separate calls, and a small change where list is detached. Slight little flicker as it adjusts, but I can live with it.
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: LISTBROWSER_Top

Postby broadblues » Sat Apr 28, 2018 3:00 am

Not sure if I mentioned this in any previous post but you can reduce flicker when chnaging lists but removing it with SetAttrs() and only using SteGadgetAttrs() or equiv when you reattach the list.
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 538
Joined: Sat Jun 18, 2011 3:40 am
Location: Portsmouth, UK

Re: LISTBROWSER_Top

Postby mritter0 » Sat Apr 28, 2018 3:26 am

That was the issue I was having. I did it with 2 calls way back when, but not using SetAttrs() to detach, so it still flickered. Figured it out over time. Wish I knew earlier........
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


Return to General Developer Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron