Scrollbar problem
HejJeg har en scrollbar på en form. Jeg har problemer med denne scrollbar, da den engang imellem går i en eller anden repeat mode. Jeg har fundet en beskrivelse af løsningen på tamaracka, men jeg ved ikke, hvordan jeg skal koden den. Er der en der kan hjælpe. Beskrivelsen af løsningen er nedenunder.
Peter Below (TeamB) wrote (8/99):
See the thread "Strange DBGrid behavior" in this group, i posted a reply to
a similar question there which may shed some light on the problem.
It happens because you do long operations during a scroll event and that makes the scrollbar miss some mouse events. So don't do that, instead post a message from the event handler to the form (PostMessage) and set a flag to true. While the flag stays true you exit immediately from any further calls to the handler. In the handler for the posted message you do your long processing and when you are done you clear the flag. You may even consider disabling the scrollbar (see EnableScrollbar) while your processing is not finished.
It is more a Windows (Win9x specifically) than a Delphi problem: when you hold down the mouse on the scrollbar button it goes into an internal "scroll" mode and starts a timer. This timer is used to make the scroll action repeat while the button is still down (since the mouse does not "autorepeat" like the keyboard). Unfortunately the code seems to check the
internal state flag and not the actual mouse button state on the timer ticks. So if the scrollbar somehow misses the button up (perhaps because the message queue overflowed), which would have cleared the state and stopped the timer, it will continue to scroll while the mouse is over the scrollbar.
Jeg ved ikke, hvordan jeg brugerr postmessage for at løse dette problem. Er det noget jeg skal erstatte onscroll eventen med eller hvad.
Jeg søger et eksempel på hvordan jeg kan gøre det, ikke mere forklaring, det har jeg fundet rigelig af :)
MVH Justin Case
