PureBasic Forum
http://forums.purebasic.com/english/

ListIconGadget() Scrollbar position
http://forums.purebasic.com/english/viewtopic.php?f=13&t=31585
Page 1 of 1

Author:  RichardL [ Thu Mar 20, 2008 4:56 pm ]
Post subject:  ListIconGadget() Scrollbar position

I have a structured array that I can sort on my choice of column. I then pour it into a ListIconGadget. Later, the user needs to refresh the display because the array contents have been updated. I would like to write the new data and restore the scroll bar position so the same area of data remains visible. To achieve this I need to capture the scroll bar position, display the new data, reinstate the scroll bar and make sure the data lines up with it.

I found some example code that appears to make this happen... but not for me! If you can spare a minute please look at the attached... which is a minimal version of the big program, and tell me where I have been real stupid!

Code:
; German forum: http://www.purebasic.fr/german/viewtopic.php?t=906&highlight=
; Author: Falko (updated for PB 4.00 by Andre)
; Date: 07. December 2004
; OS: Windows
; Demo: No

; Move scrollbar of a ListIcon by command... Original version
#MyWindow = 0
#MyGadget = 1
If OpenWindow(#MyWindow,100,100,300,500,"Works OK.",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
  If CreateGadgetList(WindowID(#MyWindow))
    ListIconGadget(#MyGadget,5,5,290,490,"Name",150,#PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
    AddGadgetColumn(#MyGadget,1,"Adresse",250)
    For i=1 To 500
      AddGadgetItem(#MyGadget,-1,Str(i)+" Harry Rannit"+Chr(10)+"12 Parliament Way, Battle Street, By the Bay")
    Next i
   
    For A=1 To 401
      SetScrollPos_(GadgetID(#MyGadget),#SB_VERT,A,#True)
      SendMessage_(GadgetID(#MyGadget),#WM_VSCROLL,#SB_LINEDOWN,0)
      Delay(10)
    Next A
    For A=401 To 1 Step -1
      SetScrollPos_(GadgetID(#MyGadget),#SB_VERT,A,#True)
      SendMessage_(GadgetID(#MyGadget),#WM_VSCROLL,#SB_LINEUP,0)
      Delay(10)
    Next A
   
    Repeat
      EventID = WindowEvent()
    Until EventID = #PB_Event_CloseWindow And EventWindow() = #MyWindow
  EndIf
EndIf
FreeGadget(#MyGadget)
CloseWindow(#MyWindow)
Delay(1000)

; My version... writes all data, positions scrollbar. Then finds scrollbar, clears data, re-writes data to list and tries to fix
; the scrollbar and text to original position.
#MyWindow = 0
#MyGadget = 1
If OpenWindow(#MyWindow,100,100,300,500,"Problem. Read comments.",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
  If CreateGadgetList(WindowID(#MyWindow))
    ListIconGadget(#MyGadget,5,5,290,490,"Name",150,#PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
   
    ; Write some initial data to gadget
    For i = 0 To 499
      AddGadgetItem(#MyGadget,-1,Str(i)+" Harry Rannit"+Chr(10)+"Original")
    Next 
   
    ; Position scroll bar... why does the text not move to proper position?
    ; Falko's example makes it move! (Apparently)
    SetScrollPos_(GadgetID(#MyGadget),#SB_VERT,150,#True)     ; Position 150
    SendMessage_(GadgetID(#MyGadget),#WM_VSCROLL,#SB_LINEDOWN,0)
   
    ; Get the scroll bar position
    KeepPosition = getScrollPos_(GadgetID(#MyGadget),#SB_VERT) - 1
    MessageRequester("Test","Note position = "+Str(KeepPosition))
    ; ==========================================================================
   
    ; Erase and Rewrite the data. (In the real app it is refreshed and some columns change)
    ClearGadgetItemList(#MyGadget)
    For i = 0 To 499
      AddGadgetItem(#MyGadget,-1,"")
      SetGadgetItemText(#MyGadget,i,Str(i)+"  Version 2",0)
    Next
   
    ; Set the scroll bar... Again the text does not move
    SetScrollPos_(GadgetID(#MyGadget),#SB_VERT,KeepPosition,#True)
    SendMessage_(GadgetID(#MyGadget),#WM_VSCROLL,#SB_LINEDOWN,0)
   
    ; Wait for exit... Try scrolling the bar several times and watch carefully.
    ; For a while there are lots of blank lines at the top of the screen and
    ; then they disappear... watch the numbers.
    Repeat
      EventID = WindowEvent()
    Until EventID = #PB_Event_CloseWindow And EventWindow() = #MyWindow
  EndIf
EndIf

 
 

Thanks... happy Easter.

Author:  netmaestro [ Thu Mar 20, 2008 5:13 pm ]
Post subject: 

You can just send the #LVM_ENSUREVISIBLE message for the item you want.

Author:  RichardL [ Thu Mar 20, 2008 5:25 pm ]
Post subject: 

My experience is that this ensures that the item required is 'visible' (as it says on the tin) but not necessarily at a a consistent place on the screen... The user will move a specific line of text to a position on the screen and needs it to stay at the same place during multiple refreshes... he can watch a value changing in the same place.

My display is nine columns wide and 24 rows high with lots of coloured cells indicating over/under pressure and other things. Movement causes lots of confusion!

I really would like to know why my example fails. :?

Author:  Sparkie [ Thu Mar 20, 2008 6:13 pm ]
Post subject: 

I know this doesn't answer your question Richard, but does this work for you :?:

Code:
; My version... writes all data, positions scrollbar. Then finds scrollbar, clears data, re-writes data to list and tries to fix
; the scrollbar and text to original position.
#MyWindow = 0
#MyGadget = 1
If OpenWindow(#MyWindow,100,100,300,500,"Problem. Read comments.",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
  If CreateGadgetList(WindowID(#MyWindow))
    ListIconGadget(#MyGadget,5,5,290,490,"Name",150,#PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
   
    For i = 0 To 499
      AddGadgetItem(#MyGadget,-1,Str(i)+" Harry Rannit"+Chr(10)+"Original")
    Next 
    lviRc.RECT
    lviRc\left = #LVIR_LABEL
    SendMessage_(GadgetID(#MyGadget),#LVM_GETITEMRECT, 0, @lviRc)
    iHeight = lviRc\bottom - lviRc\top
    SendMessage_(GadgetID(#MyGadget),#LVM_SCROLL,0,iHeight*150)
   
    ; Get the top item
    KeepPosition = SendMessage_(GadgetID(#MyGadget),#LVM_GETTOPINDEX,0,0)
    MessageRequester("Test","Note position = "+Str(KeepPosition))
    ; ==========================================================================
   
    SendMessage_(GadgetID(#MyGadget),#LVM_SCROLL,0,iHeight*10)
    NewPosition = SendMessage_(GadgetID(#MyGadget),#LVM_GETTOPINDEX,0,0)
    MessageRequester("Test","Note position = "+Str(NewPosition))
     
    ; Erase and Rewrite the data. (In the real app it is refreshed and some columns change)
    ClearGadgetItemList(#MyGadget)
    For i = 0 To 499
      AddGadgetItem(#MyGadget,-1,"")
      SetGadgetItemText(#MyGadget,i,Str(i)+"  Version 2",0)
    Next
   
    SendMessage_(GadgetID(#MyGadget),#LVM_SCROLL,0,iHeight*KeepPosition)
   
    Repeat
      EventID = WindowEvent()
    Until EventID = #PB_Event_CloseWindow And EventWindow() = #MyWindow
  EndIf
EndIf

Author:  Sparkie [ Thu Mar 20, 2008 7:43 pm ]
Post subject: 

To answer your question Richard, in your code, #SB_LINEDOWN is called once after each SetScrollPos_(), whereas in Falko's code, it's called many times in a loop, therefore you see each line movement. :wink:

Author:  bhatkins2000 [ Wed Jan 22, 2014 7:02 pm ]
Post subject:  Re: ListIconGadget() Scrollbar position

I am creating an application that does scheduling for a mfg company.

the application uses 2 listicons that I would like to keep synchronized horizontally. The main listicon has columns of data that are summed into the slave listicon.

As the user scrolls horizontally on the main listicon I would like for the slave to move in sync. If the left side of main is column 4 then the left side of slave should also be 4. This should happen whether you are using the horizontal scroll bar or the left and right arrow keys.

In the code below the left and right arrow keys work. The scroll bar moves like I would like it to but the contents of the slave listicon don't move.

I would love any advice or education about how to make this work.

Code:
Enumeration
  #SLAVE       ;1
  #MAIN        ;2
EndEnumeration

Procedure WindowCallback(hWnd,uMsg,wParam,lParam)

   Select uMsg
       Case #WM_NOTIFY
         A = GetScrollPos_(GadgetID(#MAIN),#SB_HORZ)
         Debug "A = " + Str(A)
          SetScrollPos_(GadgetID(#SLAVE),#SB_HORZ,A,#True)
          SendMessage_(GadgetID(#SLAVE), #LVM_ENSUREVISIBLE, A, 0)
     
      Case #WM_KEYDOWN ,#WM_MENUSELECT
        If wParam=#VK_LEFT
          SendMessage_(GadgetID(#SLAVE),#WM_HSCROLL,#SB_LEFT          ,0)
          SendMessage_(GadgetID(#MAIN),#WM_HSCROLL,#SB_LEFT,0)
        ElseIf wParam=#VK_RIGHT
          SendMessage_(GadgetID(#SLAVE),#WM_HSCROLL,#SB_RIGHT,0)
          SendMessage_(GadgetID(#MAIN),#WM_HSCROLL,#SB_RIGHT,0)
        EndIf             
   EndSelect
   
   ProcedureReturn #PB_ProcessPureBasicEvents
 EndProcedure
 
OpenWindow(0,0,0,1000,320,"HORZ",#PB_Window_SystemMenu | #PB_Window_ScreenCentered)

ListIconGadget(#SLAVE,0,0,980,80,"NameSLAVE",100)
AddGadgetColumn(#SLAVE,1,"COL2",200)
AddGadgetColumn(#SLAVE,2,"COL3",200)
AddGadgetColumn(#SLAVE,3,"COL4",200)
AddGadgetColumn(#SLAVE,4,"COL5",200)
AddGadgetColumn(#SLAVE,5,"COL6",200)
AddGadgetColumn(#SLAVE,6,"COL7",200)
AddGadgetColumn(#SLAVE,7,"COL8",200)
AddGadgetColumn(#SLAVE,8,"COL9",200)
AddGadgetColumn(#SLAVE,9,"COL10",200)
AddGadgetColumn(#SLAVE,10,"COL11",200)

ListIconGadget(#MAIN,0,85,980,160,"NameMAIN",100)
AddGadgetColumn(#MAIN,1,"COL2",200)
AddGadgetColumn(#MAIN,2,"COL3",200)
AddGadgetColumn(#MAIN,3,"COL4",200)
AddGadgetColumn(#MAIN,4,"COL5",200)
AddGadgetColumn(#MAIN,5,"COL6",200)
AddGadgetColumn(#MAIN,6,"COL7",200)
AddGadgetColumn(#MAIN,7,"COL8",200)
AddGadgetColumn(#MAIN,8,"COL9",200)
AddGadgetColumn(#MAIN,9,"COL10",200)
AddGadgetColumn(#MAIN,10,"COL11",200)

text$ = "SLAVE"
For i=1 To 11
  text$ = text$ + Chr(10) + Str(i)
Next
AddGadgetItem(#SLAVE,-1,text$)

For i=1 To 10
   AddGadgetItem(#MAIN,-1,"Gadget Item #" + Str(i)  + Chr(10) + Str(i) + Chr(10) + Str(i) + Chr(10) + Str(i) + Chr(10) + Str(i) + Chr(10) + Str(i) + Chr(10) + Str(i) + Chr(10) + Str(i) + Chr(10) + Str(i) + Chr(10) + Str(i) + Chr(10) + Str(i))
 Next
 
SetWindowCallback(@WindowCallback())

While WaitWindowEvent() ! #PB_Event_CloseWindow : Wend


Thanks in advance for any help.

Author:  srod [ Wed Jan 22, 2014 7:52 pm ]
Post subject:  Re: ListIconGadget() Scrollbar position

The following any use for you?

Note that this code absolutely assumes that both gadgets are the same width.

Code:
Global gOldProc

Enumeration
  #SLAVE       ;1
  #MAIN        ;2
EndEnumeration

Procedure Callback(hWnd,uMsg,wParam,lParam)
  Protected result, hWndSlave, sinfMain.SCROLLINFO, sinfSlave.SCROLLINFO
  result = CallWindowProc_(gOldProc, hWnd,uMsg,wParam,lParam)
  If uMsg = #WM_HSCROLL Or (uMsg = #WM_KEYDOWN And (wParam = #VK_RIGHT Or wParam = #VK_LEFT))
    With sinfMain
      \cbSize = SizeOf(SCROLLINFO)
      \fMask = #SIF_ALL
    EndWith
    GetScrollInfo_(hWnd, #SB_HORZ, sinfMain)
    hWndSlave = GadgetID(#SLAVE)
    With sinfSlave
      \cbSize = SizeOf(SCROLLINFO)
      \fMask = #SIF_ALL
    EndWith
    GetScrollInfo_(hWndSlave, #SB_HORZ, sinfSlave)
    SendMessage_(hWndSlave, #LVM_SCROLL, sinfMain\nPos - sinfSlave\nPos, 0)
  EndIf
   ProcedureReturn result
 EndProcedure
 
OpenWindow(0,0,0,1000,320,"HORZ",#PB_Window_SystemMenu | #PB_Window_ScreenCentered)

ListIconGadget(#SLAVE,0,0,980,80,"NameSLAVE",100)
AddGadgetColumn(#SLAVE,1,"COL2",200)
AddGadgetColumn(#SLAVE,2,"COL3",200)
AddGadgetColumn(#SLAVE,3,"COL4",200)
AddGadgetColumn(#SLAVE,4,"COL5",200)
AddGadgetColumn(#SLAVE,5,"COL6",200)
AddGadgetColumn(#SLAVE,6,"COL7",200)
AddGadgetColumn(#SLAVE,7,"COL8",200)
AddGadgetColumn(#SLAVE,8,"COL9",200)
AddGadgetColumn(#SLAVE,9,"COL10",200)
AddGadgetColumn(#SLAVE,10,"COL11",200)

ListIconGadget(#MAIN,0,85,980,160,"NameMAIN",100)
AddGadgetColumn(#MAIN,1,"COL2",200)
AddGadgetColumn(#MAIN,2,"COL3",200)
AddGadgetColumn(#MAIN,3,"COL4",200)
AddGadgetColumn(#MAIN,4,"COL5",200)
AddGadgetColumn(#MAIN,5,"COL6",200)
AddGadgetColumn(#MAIN,6,"COL7",200)
AddGadgetColumn(#MAIN,7,"COL8",200)
AddGadgetColumn(#MAIN,8,"COL9",200)
AddGadgetColumn(#MAIN,9,"COL10",200)
AddGadgetColumn(#MAIN,10,"COL11",200)

text$ = "SLAVE"
For i=1 To 11
  text$ = text$ + Chr(10) + Str(i)
Next
AddGadgetItem(#SLAVE,-1,text$)

For i=1 To 10
   AddGadgetItem(#MAIN,-1,"Gadget Item #" + Str(i)  + Chr(10) + Str(i) + Chr(10) + Str(i) + Chr(10) + Str(i) + Chr(10) + Str(i) + Chr(10) + Str(i) + Chr(10) + Str(i) + Chr(10) + Str(i) + Chr(10) + Str(i) + Chr(10) + Str(i) + Chr(10) + Str(i))
 Next
 

gOldProc = SetWindowLongPtr_(GadgetID(#main), #GWL_WNDPROC, @Callback())


While WaitWindowEvent() ! #PB_Event_CloseWindow : Wend

Author:  bhatkins2000 [ Wed Jan 22, 2014 8:29 pm ]
Post subject:  Re: ListIconGadget() Scrollbar position

Thanks, srod.

That is perfect.

Author:  Michael Vogel [ Sat Jun 29, 2019 2:43 pm ]
Post subject:  Re: ListIconGadget() Scrollbar position

Does anyone know if ListViewGadgets could also be controlled to set the scrollbar position? I don't need to sync with another gadget but I'd like to scroll around quickly using some keyboard shortcuts...

Author:  RSBasic [ Sat Jun 29, 2019 3:37 pm ]
Post subject:  Re: ListIconGadget() Scrollbar position

Code:
SetGadgetState(#YourGadget, YourItemNr)

Or:
Code:
SendMessage_(GadgetID(#YourGadget), #LB_SETTOPINDEX, YourItemNr, 0)

Author:  Michael Vogel [ Sat Jun 29, 2019 11:04 pm ]
Post subject:  Re: ListIconGadget() Scrollbar position

Any chance to control the horizontal and vertical scrollbar?

Below the masterhandle (listicon) can be set as wanted, the slavehandle (listview) does only the line selection...

Code:
Enumeration
   #SLAVE       ;1
   #MAIN        ;2
EndEnumeration

Procedure.s AddViewGadgetItem(gadget,text.s,update=#True)

   Protected hdc
   Protected id
   Protected fontid
   Protected size.Size

   #Undefined=-#True

   AddGadgetItem(gadget,#Undefined,text)

   id=GadgetID(gadget)
   hdc=GetDC_(id)
   fontid=GetGadgetFont(gadget)

   SelectObject_(hdc,fontid)
   GetTextExtentPoint32_(hdc,@text,Len(text),size)

   size\cx+8;                                                   ein paar Pixel breiter (rechter Rand)
   If size\cx>SendMessage_(id,#LB_GETHORIZONTALEXTENT,0,0)
      SendMessage_(id,#LB_SETHORIZONTALEXTENT,size\cx,0)
   EndIf

   If ActiveGadget<>gadget Or GetGadgetState(gadget)=#Undefined;            GetActiveGadget() liefert in Threads immer Null
      ;SendMessage_(id,#LVM_ENSUREVISIBLE,CountGadgetItems(gadget)-1,0);      ListIconGadget
      SendMessage_(id,#LB_SETTOPINDEX,CountGadgetItems(gadget)-1,0);         ListViewGadget
   EndIf

   If update
      UpdateWindow_(id)
   EndIf

EndProcedure

OpenWindow(0,0,0,1000,340,"HORZ",#PB_Window_SystemMenu | #PB_Window_ScreenCentered)

slavehandle=ListViewGadget(#SLAVE,0,0,980,160)
text$ = "  . . . . . . . . . . .  "
For i=2 To 10
   text$ = text$ + Str(i) + "   . . . . . . . . . . . . . . . . . . . . . . . . . . . . .    "
Next

masterhandle=ListIconGadget(#MAIN,0,170,980,160,"NameMAIN",100)
For i=1 To 10
   AddGadgetColumn(#MAIN,I,"COL"+Str(i+1),200)
Next i

For i=1 To 30
   AddViewGadgetItem(#SLAVE,Str(i)+text$)
   AddGadgetItem(#MAIN,-1,"Gadget Item #" + Str(i)  + Chr(10) + Str(i) + Chr(10) + Str(i) + Chr(10) + Str(i) + Chr(10) + Str(i) + Chr(10) + Str(i) + Chr(10) + Str(i) + Chr(10) + Str(i) + Chr(10) + Str(i) + Chr(10) + Str(i) + Chr(10) + Str(i))
Next

SendMessage_(masterhandle,#LVM_SCROLL,500,150)
SendMessage_(slavehandle,#LB_SETTOPINDEX,5,0)

While WaitWindowEvent() ! #PB_Event_CloseWindow : Wend

Author:  RASHAD [ Sun Jun 30, 2019 3:55 am ]
Post subject:  Re: ListIconGadget() Scrollbar position

Hi MV
Workaround for Windows
Full control over ListView()
You can use it in Procedure as well
Code:
LoadFont(0,"Tahoma",14)
If OpenWindow(0,0,0,420,250,"Window",#PB_Window_SystemMenu| #PB_Window_ScreenCentered) 
  ScrollAreaGadget(0, 10, 10, 400, 200,400,400,20)
    ListViewGadget(1,0,0,1000,1000)
    SetGadgetFont(1,FontID(0))
  CloseGadgetList()
  text$ = "yiuy ioy  oiuoi uoiu oiu oiu uoi io oi uo yioioiyiuyui iouioioiyoiyoiyoiy oiy oiy oiy o yoiy oiyoiy "
  For i = 0 To 100
    AddGadgetItem(1, -1, Str(i)+" "+text$)
  Next
  count = SendMessage_(GadgetID(1),#LB_GETCOUNT,0,0)
  For i = 0 To count - 1
    SendMessage_(GadgetID(1),#LB_GETITEMRECT,i,r.RECT)
    If r\right > width
      width = r\right
    EndIf
  Next
  width = r\right
  height = SendMessage_(GadgetID(1),#LB_GETITEMHEIGHT,0,0)
  theight = height*count
  ResizeGadget(1,0,0,width+20,theight+20)
  SetGadgetAttribute(0,#PB_ScrollArea_InnerWidth,width)
  SetGadgetAttribute(0,#PB_ScrollArea_InnerHeight,theight)
  SetGadgetAttribute(0,#PB_ScrollArea_ScrollStep,height)
  SetGadgetAttribute(0, #PB_ScrollArea_X, 50)         ; Pixel 50 Hal
  SetGadgetAttribute(0, #PB_ScrollArea_Y, 10*height)  ; Row 10 Val
 
Repeat
    Select WaitWindowEvent(1)
      Case #PB_Event_CloseWindow
        Quit = 1
           
    EndSelect

Until Quit = 1
EndIf

End

Author:  Michael Vogel [ Tue Jul 02, 2019 7:59 pm ]
Post subject:  Re: ListIconGadget() Scrollbar position

Thanks Rashad, did a more 'dramatic' (or to be honest: weird) thing now...

Code:
; Define
   Enumeration
      #WinMake
   EndEnumeration

   Enumeration
      #MakeScrollUp
      #MakeScrollDown
      #MakeScrollLeft
      #MakeScrollRight
   EndEnumeration

   Structure ScrollerDotType
      dot.Point[4]
   EndStructure

; EndDefine

Procedure.s AddViewGadgetItem(gadget,text.s,update=#True)

   Protected hdc
   Protected id
   Protected fontid
   Protected size.Size

   #Undefined=-#True

   AddGadgetItem(gadget,#Undefined,text)

   id=GadgetID(gadget)
   hdc=GetDC_(id)
   fontid=GetGadgetFont(gadget)

   SelectObject_(hdc,fontid)
   GetTextExtentPoint32_(hdc,@text,Len(text),size)

   size\cx+8;                                                   
   If size\cx>SendMessage_(id,#LB_GETHORIZONTALEXTENT,0,0)
      SendMessage_(id,#LB_SETHORIZONTALEXTENT,size\cx,0)
   EndIf

   If ActiveGadget<>gadget Or GetGadgetState(gadget)=#Undefined;         
      SendMessage_(id,#LB_SETTOPINDEX,CountGadgetItems(gadget)-1,0);
   EndIf

   If update
      UpdateWindow_(id)
   EndIf

EndProcedure
Procedure GetScrollerDots(window,*dot.ScrollerDotType)

   Protected offset.point
   Protected out.rect
   Protected in.rect
   Protected scroll,mid

   ClientToScreen_(window,offset)
   GetWindowRect_(window,out)
   GetClientRect_(window,in)

   scroll=out\right-in\right-offset\x

   mid=scroll>>1
   scroll+3

   *dot\dot[#MakeScrollLeft]\x=      scroll
   *dot\dot[#MakeScrollLeft]\y=      in\bottom+mid
   *dot\dot[#MakeScrollRight]\x=   in\right-scroll
   *dot\dot[#MakeScrollRight]\y=   in\bottom+mid
   *dot\dot[#MakeScrollUp]\x=         in\right+mid
   *dot\dot[#MakeScrollUp]\y=      in\top+scroll
   *dot\dot[#MakeScrollDown]\x=   in\right+mid
   *dot\dot[#MakeScrollDown]\y=      in\bottom-scroll

EndProcedure
Procedure DoScrollerDot(window,*dot.point)

   Protected dot.Point
   Protected cur.Point

   ClientToScreen_(window,dot)
   GetCursorPos_(cur)
   SetCursorPos_(dot\x+*dot\x,dot\y+*dot\y)
   mouse_event_(#MOUSEEVENTF_LEFTDOWN,0,0,0,0)
   mouse_event_(#MOUSEEVENTF_LEFTUP,0,0,0,0)
   SetCursorPos_(cur\x,cur\y)

EndProcedure

OpenWindow(#WinMake,300,0,1000,340,"Use Ctrl+Cursor Keys to scroll...",#PB_Window_SystemMenu )

AddKeyboardShortcut(#WinMake,#PB_Shortcut_Up|#PB_Shortcut_Control ,#MakeScrollUp)
AddKeyboardShortcut(#WinMake,#PB_Shortcut_Down |#PB_Shortcut_Control ,#MakeScrollDown)
AddKeyboardShortcut(#WinMake,#PB_Shortcut_Left |#PB_Shortcut_Control ,#MakeScrollLeft)
AddKeyboardShortcut(#WinMake,#PB_Shortcut_Right |#PB_Shortcut_Control ,#MakeScrollRight)

ListHandle=ListViewGadget(1,0,0,980,320)

text$ = "  . . . . . . . . . . .  "
For i=2 To 10
   text$ = text$ + Str(i) + "   . . . . . . . . . . . . . . . . . . . . . . . . . . . . .    "
Next

For i=1 To 30
   AddViewGadgetItem(1,Str(i)+text$)
Next

ListDot.ScrollerDotType
GetScrollerDots(ListHandle,ListDot)

Repeat
   Select WaitWindowEvent()
   Case #PB_Event_Menu
      DoScrollerDot(ListHandle,ListDot\dot[EventGadget()])
   Case #PB_Event_CloseWindow
      End
   EndSelect
ForEver

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/