LISTBROWSER_Top
Posted: Thu Apr 26, 2018 11:41 pm
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.
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)
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);
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)