PureBasic Forumhttp://forums.purebasic.com/english/ How to obtain number of element at top of scrolling windowhttp://forums.purebasic.com/english/viewtopic.php?f=13&t=73021 Page 1 of 1

 Author: Blue [ Fri Jun 14, 2019 6:22 am ] Post subject: How to obtain number of element at top of scrolling window Sorry for the clumsy wording of the question...I'm pretty sure I saw this question asked and answered before, but I don't even know how to formulate my search intelligently enough to get an answer. I've tried — in vain — all I could think of. Since words won't come to mind, allow me to use a picture :

 Author: RASHAD [ Fri Jun 14, 2019 8:07 am ] Post subject: Re: How to obtain number of element at top of scrolling wind Hello BlueCode:OpenWindow(0,200,200,400,150,"Title", #PB_Window_SystemMenu|#PB_Window_ScreenCentered) TreeGadget(1,0,0,400,150) For t=1 To 50  AddGadgetItem(1,-1,"item : "+Str(t)) Next Repeat   Select WaitWindowEvent()    Case #PB_Event_CloseWindow          Quit = 1              Case #WM_NCMOUSEMOVE        Position = SendMessage_(GadgetID(1), #WM_NCHITTEST, 0, DesktopMouseY()<<16 + DesktopMouseX())        Select Position          Case #HTVSCROLL            item = GetScrollPos_(GadgetID(1), #SB_VERT)+1            If item <> olditem                            Debug "First Visible Item  = " + Str(item)            EndIf            olditem = item        EndSelect                  Case #WM_KEYUP        If GetActiveGadget() = 1 And (EventwParam() = 38 Or EventwParam() = 40)          item = GetScrollPos_(GadgetID(1), #SB_VERT)+1          If item <> olditem                          Debug "First Visible Item  = " + Str(item)          EndIf          olditem = item        EndIf            EndSelect Until Quit = 1

 Author: C87 [ Fri Jun 14, 2019 9:21 am ] Post subject: Re: How to obtain number of element at top of scrolling wind Hello Blue, Having seen your post, I'm interested to know which software you used to show your example with the graphics and text added?Also, have to say the solutions to your problem are absolutely first class. As it is so often the case in the PureB forum. Cheers, C87

 Author: RASHAD [ Fri Jun 14, 2019 9:25 am ] Post subject: Re: How to obtain number of element at top of scrolling wind Thanks Shardik I did not remember anyI should save my posts and the other forum members posts with the URL.BadThanks also for your snippet