Replies: 5 comments
Option 1: Alter
|
Option 2: Publicly expose a method for consumers to call as a workaround (
|
Option 3: Keep the internal hook as-is. Add a new event handler for consumers to use (
|
Option 4: Same as 3, but enforce this requirement when painting by detecting if
|
Option 5: Same as 4 except don't expose the new handler. Detect if
|
Uh oh!
There was an error while loading. Please reload this page.
This is a discussion for PR #1402 on how to resolve concerns about utilizing
Background.OnChangeto determine when the cached image should be reprepared.Problem
The recent background-bitmap caching work (
FBackgroundPrepared) invalidates its cached bitmap by hookingBackground.OnChange. SinceBackgroundis a public property andOnChangeis a single-slotTNotifyEvent, any consumer that doesTree.Background.OnChange := MyHandlerafter construction silently replaces the tree's internal hook. Subsequent background changes then leave the cached bitmap stale, and the tree keeps painting the old image.Options
Posted below as separate comments so each can be discussed/reacted-to independently:
TVTBackgroundto support multiple independent change listeners, leavingOnChangeentirely free for consumers.InvalidateBackgroundmethod - consumers call it manually after modifyingBackground.OnBackgroundChangeevent - internal hook stays as-is; documentBackground.OnChangeas reserved.Background.OnChangegets overwritten.Feedback on which direction to take (or a different one entirely) is welcome before I put together an implementation.
All reactions