2

I'm using Embarcadero Software's C++Builder to display some form-based graphics; the canvas is scrollable, and when you move the mouse wheel, the event handler does some internal calculations which decide where the scroll bar should go. Then it sets the scroll bar position.

Like this, roughly:

if (ScrollBox->HorzScrollBar->IsScrollBarVisible() )
{
    OffsetX = MyHorzScroll + 0.5;  // round to int
    ScrollBox->HorzScrollBar->Position = OffsetX;
    }

where ScrollBox is of type FMX.Layouts.TScrollBox. The problem is that, intermittently, the Position doesn't actually go to the value I set it to. There are two circumstances that make me suspect it's a memory overwrite issue: first, when I commment out some lines that set a member variable named MyScale, the error goes away; second, it also goes away when I change OffsetX's declaration to static storage. The documentation doesn't really give any hints about deeper memory requirements--Help tells me I can just set Position to any int value with the = function and it should work (although it is more than a simple integer under the hood, the = is supposed to be overridden with a setter function that takes care of it).

Anyone know how to force a Borland/Embarcadero scroll bar to work?

Johan
  • 74,508
  • 24
  • 191
  • 319
user2084572
  • 331
  • 3
  • 12

0 Answers0