Normal şekilde aşağı kaydırabiliyorum ama yukarı kaydırdığımda kaydırma çubuğu yukarı çıkıyor ama öğeleri göremiyorum, sorun liste kutusunda ama hiç çözemedim, bu sorunu düzeltmek için bir fikriniz var mı?
uiitemshopnew:
class ListBox(ui.Window):
def __init__(self, isHorizontal = False):
ui.Window.__init__(self)
self.viewItemCount=10
self.basePos=0
self.itemHeight=16
self.itemStep=20
self.itemList=[]
self.itemWidth=100
self.scrollBar=None
self.isHorizontal= isHorizontal
def __del__(self):
ui.Window.__del__(self)
def __GetItemCount(self):
return len(self.itemList)
def SetItemStep(self, itemStep):
self.itemStep=itemStep
def SetItemSize(self, itemWidth, itemHeight):
self.itemWidth=itemWidth
self.itemHeight=itemHeight
def SetViewItemCount(self, viewItemCount):
self.viewItemCount=viewItemCount
def RemoveAllItems(self):
for item in self.itemList:
item.Destroy()
self.itemList=[]
if self.scrollBar:
self.scrollBar.SetPos(0)
def GetItems(self):
return self.itemList
def RemoveItem(self, delItem):
self.itemList.remove(delItem)
def AppendItem(self, newItem):
self.itemList.append(newItem)
if app.ENABLE_MOUSEWHEEL_EVENT:
newItem.SetMouseWheelScrollEvent(self.OnMouseWheelScroll_ScrollBar)
def SetScrollBar(self, scrollBar):
scrollBar.SetScrollEvent(ui.__mem_func__(self.__OnScroll))
self.scrollBar=scrollBar
if app.ENABLE_MOUSEWHEEL_EVENT:
self.SetMouseWheelScrollEvent(self.OnMouseWheelScroll_ScrollBar)
if app.ENABLE_MOUSEWHEEL_EVENT:
def OnMouseWheelScroll_ScrollBar(self,mode):
if self.scrollBar:
if mode == "UP":
self.scrollBar.OnUp()
else:
self.scrollBar.OnDown()
def OnMouseWheel(self, nLen):
if self.scrollBar:
if self.scrollBar.IsShow():
if nLen > 0:
self.scrollBar.OnUp()
else:
self.scrollBar.OnDown()
return True
return False
def __OnScroll(self):
self.SetBasePos(int(self.scrollBar.GetPos()*self.__GetScrollLen()))
def __GetScrollLen(self):
if self.__GetItemCount() == 0:
return 0
(lx,ly) = self.itemList[len(self.itemList)-1].myPos
return ly
def Render(self,basePos):
for item in self.itemList:
(ex,ey) = item.myPos
if self.isHorizontal:
item.SetPosition(ex-(basePos),ey)
else:
item.SetPosition(ex,ey-(basePos))
item.OnRender()
def SetBasePos(self, basePos):
if self.basePos == basePos:
return
self.Render(basePos)
self.basePos=basePos