HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: [Resolved] Can Scrollable Parents be scrolled from script?  (Read 2690 times)

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.

I have looked for and been unable to find some way to be able to scroll a scrollable parent the way it happens when you drag a scroll thumb, but do it from a script call.  Or at least be able to set it to a given scroll value.

Anyone know if this can be done?
« Last Edit: Apr 13, 13, 07:02:02 PM by ScottZarnke »
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

EO-CaSpivey

  • General Accounts
  • *
  • Posts: 16
  • HSL Engineer
    • View Profile
    • Exile Online
Re: Can Scrollable Parents be scrolled from script?
« Reply #1 on: Mar 27, 13, 10:11:53 AM »

Hmm, Im fairly certain the HJRef Chat uses some kind of auto-scroll. That may point you in the right direction.
Logged
HSL Engineer | Exile Gaming Studio
Website: www.exile-online.com
Follow Us: www.indiedb.com/games/exileonline

TGSRofar

  • General Accounts
  • *
  • Posts: 153
    • View Profile
Re: Can Scrollable Parents be scrolled from script?
« Reply #2 on: Mar 27, 13, 04:58:58 PM »

Only way I know to do it is to set the offset.y property of the clientarea that is being scrolled.
Logged
Ron Farrell
Lead Programmer
Triad Game Studios

Thazager

  • General Accounts
  • *
  • Posts: 1160
  • Never stop learning
    • View Profile
Re: Can Scrollable Parents be scrolled from script?
« Reply #3 on: Apr 11, 13, 12:17:35 AM »

I was able to get this partially working, but did not continue in that section as I was needed on other parts. I can get the page to scroll on screen, but something else is needed to load in the next thing from the client area, as thumb movement would do.
Logged
Lead scripter for EO, Repop helper.
HSL Video tutorials:
https://community.heroengine.com/forums/index.php/topic,1719.msg36858.html#msg3685

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: [Resolved] Can Scrollable Parents be scrolled from script?
« Reply #4 on: Apr 13, 13, 07:03:11 PM »

I have this working by adjusting the offset of the clientarea when the user rolls the mouse wheel and it works perfect.  Thanks!
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

Thazager

  • General Accounts
  • *
  • Posts: 1160
  • Never stop learning
    • View Profile
Re: [Resolved] Can Scrollable Parents be scrolled from script?
« Reply #5 on: Apr 19, 13, 04:17:09 AM »

Yep, works great. Need to add GUIScrollablePanelClassDefaults to the panel you want to scroll. Then change the me.HJCharacterShop_GetSelectedClientarea() to point at your new panel area in code below.

From HJref a function that does it.

Code: [Select]
method onMouseWheel(args references Class GUIMouseEvent)
  //-------------------------------------
  // Allow mouse wheel scrolling of items
  //-------------------------------------
  var c = me.HJCharacterShop_GetSelectedClientarea()
  where c is kindof GUIScrollablePanel
//      println("Area: " + c.area.y + " offset: " + c.offset.y)
    if args.wheelDelta > 0
      var newOffset = c.offset.y - 60
      if newOffset < 0
        newOffset = 0
      .
      if newOffset > (c.area.y - c.size.y)
        newOffset = c.area.y - c.size.y
      .
      c.offset.y = newOffset
    else
      var newOffset = c.offset.y + 60
      if newOffset < 0
        newOffset = 0
      .
      if newOffset > (c.area.y - c.size.y)
        newOffset = c.area.y - c.size.y
      .
      c.offset.y = newOffset
    .
  .
.

Logged
Lead scripter for EO, Repop helper.
HSL Video tutorials:
https://community.heroengine.com/forums/index.php/topic,1719.msg36858.html#msg3685