[Lazarus] Visual "uglyness" when creating TSynEdit @ runtime in my app
lazarus at mfriebe.de
Sat Jan 5 13:33:40 CET 2013
On 05/01/2013 12:03, luiz americo pereira camara wrote:
> 2013/1/5 Martin <lazarus at mfriebe.de>:
>> On 05/01/2013 11:43, luiz americo pereira camara wrote:
>>> If I single step, it is not painted by that line.
>>> It happens here
>>> Perform(CM_SHOWINGCHANGED, 0, 0); // see
>>> This ends with TWin32WSWinControl.ShowHide that calls SetWindowPos
>>> which should not trigger a immediate wm_paint
>>> What OS are you using?
>> Win Vista 32 bit
>>> Did you tried commenting the code inside TWin32WidgetSet.ShowScrollBar?
>> No, I single stepped, and checked, when the paint happened.
> Due to LCL/Win message nature, not always the backtrace correspond to
> the code that actually triggered the event.
> At this time, i'm not sure what exactly is triggering the paint
> message you are seeing.
> Sometimes the only way to know is by trial and error.
> If commenting the code inside TWin32WidgetSet.ShowScrollBar avoids the
> paint, we will know that the problem is there, so we can try to fix,
> otherwise we will look elsewhere
> I just double checked and here no WM_PAINT message is triggered
> Maybe is related to windows below windows 7
I traced it further, using the assembler.
class procedure TWin32WSWinControl.ShowHide(const AWinControl: TWinControl);
VisibilityToFlag: array[Boolean] of UINT = (SWP_HIDEWINDOW,
Windows.SetWindowPos(AWinControl.Handle, 0, 0, 0, 0, 0,
SWP_NOSIZE or SWP_NOMOVE or SWP_NOZORDER or SWP_NOACTIVATE or
00571381 e89a08e9ff call 0x401c20
Of course, that may call WindowProc, and do other stuff....
So I set a break at:
B:\lazarus_latest_2\lcl\interfaces\win32\win32callback.inc line 1055
first line in
function WindowProc(Window: HWnd; Msg: UInt; WParam: Windows.WParam;
LParam: Windows.LParam): LResult; stdcall;
And during the above I received
70 WM_WINDOWPOSCHANGING (for SynEdit)
133 WM_NCPAINT (that does it in CallDefaultWindowProc) (also for SynEdit)
I single stepped the first (WM_WINDOWPOSCHANGING) but I dont know if
anything happens when it too calls CallDefaultWindowProc. Didn't see any
obvious calls to trigger paint.
More information about the Lazarus