﻿TMS VCL TPlanner: scrolling causes three grid paints per step with
IndicateNonVisibleItems enabled (spLeft and spTop, DoubleBuffered=True)
Date: 16 November 2026

Hello TMS Support,

We observe severe scrolling delays and high UI-thread CPU usage in a VCL
calendar. The problem is reproducible in the attached standalone TPlanner
sample, without our application, a database, custom drawing events, a
custom planner/item class, or an assigned DrawTool.

With IndicateNonVisibleItems=True and DoubleBuffered=True, each measured
scroll step produces three grid WM_PAINT calls. Setting only
IndicateNonVisibleItems=False reduces this to one. The issue reproduces
with the timeline on the left (spLeft) and on top (spTop), both for mouse
wheel and horizontal scrolling.

Please investigate redundant synchronous repaints in UpdateNVI and the
double-buffered paint path. We need an upstream fix that preserves the
non-visible-item indicators; maintaining a local TMS source patch is not
an option for us.

TESTED VERSIONS AND ENVIRONMENT

- TMS VCL UI Pack 13.6.5.1, TPlanner.Version = 3.6.2.4.
- TMS VCL UI Pack 13.8.0.0, TPlanner.Version = 3.6.2.5.
- RAD Studio / Delphi compiler 37.0 (RAD Studio 13), Release, Win64x.
- Windows Server 2025 Standard, 24H2, build 26100.33650.
- Intel Xeon Gold 6244 @ 3.60 GHz, native GDI/VCL on a private Windows desktop.
- Both TMS versions linked statically from their unmodified Release DCUs.
  No runtime TMS BPL or C++ libunwind/libc++ dependency in this Delphi sample.
- Installed components and application sources/binaries were not changed.

REPRODUCTION

1. Build source/PlannerScrollRepro.dproj using the tested TMS version.
   source/Build.ps1 accepts the compiled TMS DCU directory and optionally
   its resource directory. See README.txt for exact commands.
2. Launch PlannerScrollRepro.exe. The default is 300 appointments plus
   90 background items, 30 positions, 06:00-18:00 in 15-minute units.
   Both Planner.DoubleBuffered and Planner.GridControl.DoubleBuffered
   stay True. The default view is Sidebar.Position=spLeft.
3. Scroll over the calendar with the mouse wheel and its horizontal
   scrollbar. Toggle the IndicateNonVisibleItems checkbox and compare.
4. Check "Timeline on top (spTop)" and repeat in the transposed view.
5. For measurements, click "Benchmark both views, indicators on/off".
   Alternatively launch with /auto, or use the optional RunIsolated.py
   launcher for the private-desktop setup used for the attached results.
6. Read results/measurements.csv, steps.csv, environment.txt and progress.txt
   next to the executable. A completed run contains 24 cases and 288
   measured scroll steps. Choose 60 or 1200 in the combo to test other loads.

Expected: enabling the off-screen appointment indicators should update
the affected indicator regions without repeatedly repainting the whole
calendar for each scroll operation.

Actual: three grid paint messages per measured step with indicators on,
versus one with indicators off, accompanied by substantially longer
scroll latency and heavy CPU use. This remains reproducible in 13.8.0.0.

ATTACHED STANDALONE SAMPLE: MEASURED RESULTS

300 appointments + 90 background items. Values are mean milliseconds per
scroll step, 3 paired repetitions x 12 steps per setting and scenario.
ON/OFF means IndicateNonVisibleItems; double buffering stays enabled.

UI Pack    View    Scroll        ON ms   OFF ms   Time saved  Paints ON/OFF
13.6.5.1   spLeft  wheel        180.51    63.45      64.85%       3 / 1
13.6.5.1   spLeft  horizontal   179.39    60.58      66.23%       3 / 1
13.6.5.1   spTop   wheel        174.46    67.08      61.55%       3 / 1
13.6.5.1   spTop   horizontal   179.51    63.28      64.75%       3 / 1
13.8.0.0   spLeft  wheel        171.40    58.06      66.13%       3 / 1
13.8.0.0   spLeft  horizontal   197.16    65.95      66.55%       3 / 1
13.8.0.0   spTop   wheel        183.30    66.81      63.55%       3 / 1
13.8.0.0   spTop   horizontal   216.11    67.15      68.93%       3 / 1

The attached source and raw data are from this standalone sample. Each
version completed 24 cases / 288 measured steps with exit code 0.
All ON/OFF pairs used identical viewport sizes and actual grid scroll
positions. The scroll-step code checks that every operation moves the
grid. Counting WM_PAINT does not replace or override TMS painting.

These two sample runs validate reproduction on each version. They are
not an interleaved old/new performance study, so small cross-version
timing differences in this table should not be treated as regressions.

MEASUREMENT METHOD

- Planner client area: 1160 x 573 pixels, fixed for all cases.
- 30 positions = 10 resource groups x 3 day columns/rows.
- spLeft: DisplayScale=28, PositionWidth=100.
- spTop: DisplayScale=50, PositionWidth=48.
- Deterministic synthetic item positions, durations, texts and overlaps.
- Three warm-up steps before each group of twelve measured steps.
- ON/OFF order alternates between repetitions.
- Vertical visual scrolling: WM_MOUSEWHEEL, one wheel detent per step.
  Horizontal visual scrolling: WM_HSCROLL, SB_LINELEFT/SB_LINERIGHT.
  These describe screen directions in both orientations; with spTop,
  horizontal scrolling moves time and vertical scrolling moves resources.
- QueryPerformanceCounter measures wall time; GetThreadTimes measures
  UI-thread CPU time. CPU values are quantized Windows thread timings.
- Each step includes message processing, completion of pending painting
  and GdiFlush. RedrawWindow uses RDW_UPDATENOW | RDW_ALLCHILDREN only;
  the benchmark does not request an additional invalidation per step.
- CSV and progress-log writes occur outside the timed sections.
- The paint probe only counts incoming grid WM_PAINT messages and always
  forwards the original message to the original window procedure.
- No stack sampler, database, network calls or simultaneous builds/hash
  checks during the timing runs. No desktop switch is required.
- Percent saved = 100 x (ON - OFF) / ON, i.e. elapsed-time reduction,
  not a percentage claim about frame rate or total application speed.

RELATED EXISTING MEASUREMENTS (SEPARATE FIXTURES)

A. Application-style diagnostic, UI Pack 13.6.5.1

Before extracting the standalone reproduction, we measured our existing
planner integration with synthetic items and no database. This uses our
TDBPlanner-derived integration, production-style header configuration and
the originally assigned DrawTool. Only the indicator setting changes
between the following ON/OFF cases. Three repetitions per scenario:

View    Items  Scroll        ON ms   OFF ms   Time saved
spLeft     60  wheel        100.76    36.07      64.20%
spLeft     60  horizontal    84.55    31.21      63.09%
spLeft    300  wheel        267.79    93.07      65.24%
spLeft    300  horizontal   266.01    91.41      65.64%
spLeft   1200  wheel        788.76   280.08      64.49%
spLeft   1200  horizontal   757.20   270.84      64.23%
spTop      60  wheel         87.61    35.20      59.83%
spTop      60  horizontal   107.83    38.92      63.90%
spTop     300  wheel        263.47    99.69      62.16%
spTop     300  horizontal   282.59   100.64      64.39%
spTop    1200  wheel        292.98   112.64      61.55%
spTop    1200  horizontal   300.13   111.11      62.98%

All these ON cases had 3 grid paints per step; all OFF cases had 1.
At 300 appointments, disabling indicators saved about 62-66% of scroll
time. Absolute timings differ from the plain TPlanner sample because
the fixtures/configurations are different. Do not compare timings
across these two fixtures as though only the library version changed.

B. Controlled old/new TMS comparison of the application-style diagnostic

Same C++ fixture, same properties and data, indicators ON on both versions.
Four independent process runs per version, alternating old/new order:
old-new, new-old, old-new, new-old. 12 measured steps per scenario/run,
96 scenario runs and 1,152 measured scroll steps overall.

View     Items  Scroll       13.6.5.1 ms  13.8.0.0 ms
spLeft      60  wheel             90.52        93.79
spLeft      60  horizontal        77.25        78.01
spLeft     300  wheel            244.84       255.15
spLeft     300  horizontal       250.58       249.10
spLeft    1200  wheel            719.26       737.54
spLeft    1200  horizontal       684.87       714.31
spTop       60  wheel             81.61        86.48
spTop       60  horizontal        96.55       102.32
spTop      300  wheel            250.56       263.59
spTop      300  horizontal       253.43       257.59
spTop     1200  wheel            268.20       268.60
spTop     1200  horizontal       276.06       273.27

Both versions still produced 3 grid paints per scroll step in every
scenario. At 300 appointments, measured UI-thread CPU was about 96-97%
of one core. Observed timing changes ranged from about 1% faster to 6%
slower; paired 95% confidence intervals crossed zero in all 12 scenarios.
This series does not establish a reliable speedup or regression in the
new version. It confirms that this repaint behavior was not eliminated.

SOURCE LOCATIONS FOR TMS REVIEW

The following observations are from the unmodified Planner.pas in
UI Pack 13.8.0.0 / TPlanner 3.6.2.5. They are suspected mechanisms for
the observed behavior, not an upstream-confirmed diagnosis or a tested
patch. Line numbers can shift between releases.

1. TPlannerGrid.UpdateNVI, starting at line 17939:
   Existing indicator cleanup obtains pixel rectangles using CellRect,
   then passes them to RepaintRect in both orientation branches.
   TPlannerGrid.RepaintRect (line 23803) treats its input rectangle as
   cell coordinates, calls CellRect again, and calls synchronous Repaint
   if either calculated rectangle is empty. Please check this apparent
   pixel/cell coordinate mismatch and the resulting repaint scheduling.

2. TPlannerGrid.WMPaint, starting at line 12956:
   The double-buffered branch creates a client-sized bitmap and paints
   through a memory DC. The BeginPaint update region is not transferred
   to that memory DC before the recursive paint call. This appears to
   make even small invalidations expensive. The destination DC can clip
   the final copy, but that does not avoid work already drawn in the
   memory bitmap. Please review update-region propagation and batching.

3. TPlannerGrid.TopLeftChanged, starting at line 18061, invokes UpdateNVI
   on scrolling. The observed extra paint calls disappear when the
   indicator path is disabled, without changing buffering or scrolling.

These methods are unchanged between the two tested Planner versions.
We did not patch TMS sources to test a proposed fix. The standalone
sample keeps DrawTool=nil so our custom drawing and the DrawTool update
path are not prerequisites for reproducing the issue.

QUESTIONS FOR TMS

- Can you reproduce the 3-versus-1 paint behavior with the attached sample?
- Is this already tracked, and is a supported fix/hotfix available?
- Can indicator updates be limited to the affected regions and coalesced
  with scrolling while preserving double-buffered, flicker-free painting?
- Please include both spLeft and spTop in verification of any fix.

LIMITS AND ATTACHMENTS

The data are synthetic native-control measurements, not a live customer
database trace. Absolute times depend on hardware, GDI and system load.
Dense overlaps at 1200 appointments alter the visible drawing area,
especially in spTop, so scaling is not necessarily linear in item count.
Turning off the indicators is a measured workaround that removes that
feature; it is not an acceptable replacement for an upstream fix if
the indicators are required. Disabling double buffering is not presented
as a validated flicker-free solution.

The ZIP contains the English report, standalone source, build/run
instructions, raw numeric measurements, summaries and validation notes.
It contains no customer data, credentials, application sources, TMS
manufacturer sources/DCUs/LIBs/BPLs, or prebuilt executable.
All included customer/resource/vehicle/order labels are synthetic.

Relevant official references:
- Indicator feature and scrolling behavior:
  https://www.tmssoftware.com/site/planner.asp?s=faq&show=396
- TMS VCL UI Pack version history:
  https://www.tmssoftware.com/site/tmsvcluipack.asp?s=history

Thank you for investigating.
