There are various ways in which this could be done at the moment.
The first would be to create a set of labels and checkboxes which move when a scrollbar is adjusted.
Another option would be to do something using canvas gadgets.
I'll play around and see what I can come up with.
Edit: Here is something basic to play around with, using the idea from your first option.
#constant CHAR_RETURN chr$(10)+chr$(13)
#constant ITEM_OFFSET 50
global panel
panel=createPanel(100,100,300,100,0)
setPanelBorderStyle panel,3
type DuplicateSet
setId
trackName as string
endtype
type DuplicateSelectorComponent
checkHandle
labelHandle
endtype
global dim items(7) as DuplicateSet
populateTestList()
global dim selectorComponents(0) as DuplicateSelectorComponent
global selectorScroll
createDuplicateSelector(panel)
oldScrollValue=getScrollBarPosition(selectorScroll)
do
currentScroll=getScrollBarPosition(selectorScroll)
if currentScroll <> oldScrollValue
oldScrollValue=currentScroll
updateSelector(currentScroll)
endif
loop
function updateSelector(index)
offset=0-index
itemOffset=ITEM_OFFSET
for i=0 to array count(selectorComponents(0))-1
positionGadget selectorComponents(i).checkHandle,gadgetX(selectorComponents(i).checkHandle),offset+itemOffset*i
positionGadget selectorComponents(i).labelHandle,gadgetX(selectorComponents(i).labelHandle),offset+itemOffset*i
next i
endfunction
function populateTestList()
items(0).setId=0
items(0).trackName="Jackson 5"
items(1).setId=0
items(1).trackName="Jackson Five"
items(2).setId=1
items(2).trackName="You Had Me"
items(3).setId=1
items(3).trackName="JS - You Had Me"
items(4).setId=1
items(4).trackName="Joss Stone - You Had Me"
items(5).setId=2
items(5).trackName="Bat out of Hell"
items(6).setId=2
items(6).trackName="Bat Out of Hell _Meatloaf"
endfunction
function createDuplicateSelector(parent)
setCount=items(array count(items(0))-1).setId+1
`message str$(setCount)
global dim selectorComponents(setCount) as DuplicateSelectorComponent
for i=0 to setCount-1
selectorComponents(i).checkHandle=createCheckbox(10,0+offset,20,20,"",parent)
selectorComponents(i).labelHandle=createLabel(30,2+offset,gadgetWidth(parent),ITEM_OFFSET,genListText(findFirstItem(i)),parent)
inc offset,ITEM_OFFSET
next i
selectorScroll=createScrollBar(gadgetWidth(parent)-20,0,15,gadgetHeight(parent)-5,1,parent)
setScrollBarRange selectorScroll,0,setCount*ITEM_OFFSET
setScrollBarThumbSize selectorScroll,gadgetY(parent)
bringToFront selectorScroll
endfunction
function findFirstItem(setId)
`message str$(setId)
for i=0 to array count(items(0))
if items(i).setId=setId then result=i : i=array count(items(0))
next i
endfunction result
function genListText(index)
setId=items(index).setId
startSetId=setId
repeat
if z > 0
result$ = result$ + CHAR_RETURN + items(index+z).trackName
else
result$ = items(index+z).trackName
endif
inc z
setId = items(index+z).setId
until setId <> startSetId
endfunction result$
I recommend your first option because it more closely resembles other programs.
Currently the scrollbar only updates the position when you release it - I'll look into modifying the plugin so that it constantly updates.
BlueGUI:Windows UI Plugin - All the power of the windows interface in your DBPro games.