Just starting out? Need help? Post your questions and find answers here.
morosh
 
Posts: 23
Joined: Mon Feb 02, 2015 7:48 pm

Re: Gadget scrolling down

by morosh Sat Jan 04, 2020 9:40 am

I tried Peter'example with a ListIcon, it didn't works, no scrolling with buttons, may be I'm missing something:

Code: Select all
EnableExplicit

Enumeration
  #myWindow
  #cmdScrollDown
  #cmdScrollUp
  #myListIconGadget
EndEnumeration

Procedure EditorScrollDown()
 
  Protected Selector = GadgetID(#myListIconGadget)
  ! $(v_selector.gadget.textbox).animate( { scrollTop: $(v_selector.gadget.textbox).prop("scrollHeight")}, 500); // with animation
  ! // v_selector.gadget.textbox.scrollTop = v_selector.gadget.textbox.scrollHeight; // without animation
 
EndProcedure

Procedure EditorScrollUp()
 
  Protected Selector = GadgetID(#myListIconGadget)
  ! $(v_selector.gadget.textbox).animate( { scrollTop: 0}, 500); // with animation
  ! // v_selector.gadget.textbox.scrollTop = 0; // without animation
 
EndProcedure


OpenWindow(#myWindow, #PB_Ignore, #PB_Ignore, 500, 500, "", #PB_Window_ScreenCentered)

ButtonGadget(#cmdScrollDown, 10, 10, 220, 30, "Scroll down")
ButtonGadget(#cmdScrollUp, 240, 10, 220, 30, "Scroll up")

ListIconGadget(#myListIconGadget, 10, 50, 480, 440,"No",50)

Define Counter

For Counter = 0 To 99
  AddGadgetItem(#myListIconGadget,-1, Str(Counter))
Next


BindGadgetEvent(#cmdScrollDown, @EditorScrollDown())
BindGadgetEvent(#cmdScrollUp, @EditorScrollUp())



any help is appreciated
Thanks
User avatar
Peter
 
Posts: 691
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080

Re: Gadget scrolling down

by Peter Sat Jan 04, 2020 11:51 am

Code: Select all
Procedure ListIconGadgetScrollDown()
  SetGadgetState(#myListIconGadget, CountGadgetItems(#myListIconGadget) - 1)
EndProcedure

Procedure ListIconGadgetScrollUp()
  SetGadgetState(#myListIconGadget, 0)
EndProcedure


(like in PureBasic)

Unfortunately ListIconGadgetScrollDown() does not work because of a bug in SpiderBasic.

Greetings ... Peter
Return to Coding Questions

Who is online

Users browsing this forum: No registered users and 4 guests