Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2003-06

LCL: WMPaint

8 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Micha Nelissen
to Micha Nelissen: Two questions. 1) The WMPaint method for TCustomForm and TScrollingWinControl are exactly…
Mattias Gaertner wrote 21 lines
On Mon, 30 Jun 2003 12:54:59 +0200 "Micha Nelissen" wrote: > Mattias Gaertner wrote: >> On Mon, 30 Jun 2003 07:54:29 +0200 >> "Micha Nelissen" wrote: >> >>> Could you apply to the other part then? I have reattached the part >>> that was important. >> >> I applied it. >> Although I think, the DC=Unused is a dirty hack. Is there any >> reason, to not use a flag in TWinControl? > > Alike FNextWMEraseBkGndIsFromOurselves := true? No problem, i'd say. > I just copied this code from how delphi does it. > > It seems FBrush is not always initialized, ie. it is nil. Can you > add code to initialize it? Added.

Nice! Thanks.

Cosmetic BTW: The line with the TODO comment in TWinControl.WMPaint can be removed (since you solved the hack). Also, the comment on line 2464 of wincontrol.inc seems to be indented quite a lot :); TWinControl.WMKeyUp.

Regards,

Micha.

Reply by email

Micha Nelissen

Hi,

Two questions.

1) The WMPaint method for TCustomForm and TScrollingWinControl are exactly the same. Is it supposed to be this way?

2) The WM_ERASEBKGND really needs to be implemented, otherwise it will be black on windows. Delphi has:

  if not FDoubleBuffered or
    (TMessage(Message).wParam = TMessage(Message).lParam) then
    FillRect(Message.DC, ClientRect, FBrush.Handle);
  Message.Result := 1;

Regards,

Micha.

Reply by email

Micha Nelissen
to Micha Nelissen
Mattias Gaertner wrote 9 lines
On Mon, 30 Jun 2003 07:54:29 +0200 "Micha Nelissen" wrote: > Could you apply to the other part then? I have reattached the part > that was important. I applied it. Although I think, the DC=Unused is a dirty hack. Is there any reason, to not use a flag in TWinControl?
Alike FNextWMEraseBkGndIsFromOurselves := true? No problem, i'd say. I just
copied this code from how delphi does it.

It seems FBrush is not always initialized, ie. it is nil. Can you add code to initialize it?

Regards,

Micha.

Reply by email

Micha Nelissen
to Micha Nelissen: Two questions. 1) The WMPaint method for TCustomForm and TScrollingWinControl are exactly…
Mattias Gaertner wrote 25 lines
On Sun, 29 Jun 2003 17:34:40 +0200 "Micha Nelissen" wrote: > Micha Nelissen wrote: >> Hi, >> >> 2) The WM_ERASEBKGND really needs to be implemented, otherwise it >> will be black on windows. Delphi has: >> >> if not FDoubleBuffered or >> (TMessage(Message).wParam = TMessage(Message).lParam) then >> FillRect(Message.DC, ClientRect, FBrush.Handle); >> Message.Result := 1; > > I have attached a patch that works on windows. These last two > patches fix the TPromptDialog bug I mentioned earlier. In addition > to the erase background implementation I also added color convertion > routines for the font selection. I am unsure whether the interface > will accept the special clBlack and such, a real RGB value is better. The ColorToRGB calls were deleted with reason. System colors are theme dependent. For example clBackground can be anything (simple color, image, gradient fill, ...) and it changes, when the user changes the theme. So, the clWindowText must be sent to the interface, not the current color. It is up to the interface to convert it.

Of course, could have known that.

Could you apply to the other part then? I have reattached the part that was important.

Regards,

Micha.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: bin00043.bin
Type: application/octet-stream
Size: 983 bytes
Desc: "erase_background.patch"
Url : http://localhost/pipermail/lazarus/attachments/20030630/27ec64eb/bin00043.bin

Reply by email

Mattias Gaertner
to Micha Nelissen: Two questions. 1) The WMPaint method for TCustomForm and TScrollingWinControl are exactly…
Show quoted text 31 lines
Mattias Gaertner wrote: > On Sun, 29 Jun 2003 17:34:40 +0200 > "Micha Nelissen" wrote: > >> Micha Nelissen wrote: >>> Hi, >>> >>> 2) The WM_ERASEBKGND really needs to be implemented, otherwise it >>> will be black on windows. Delphi has: >>> >>> if not FDoubleBuffered or >>> (TMessage(Message).wParam = TMessage(Message).lParam) then >>> FillRect(Message.DC, ClientRect, FBrush.Handle); >>> Message.Result := 1; >> >> I have attached a patch that works on windows. These last two >> patches fix the TPromptDialog bug I mentioned earlier. In addition >> to the erase background implementation I also added color convertion >> routines for the font selection. I am unsure whether the interface >> will accept the special clBlack and such, a real RGB value is better. > > The ColorToRGB calls were deleted with reason. System colors are theme > dependent. For example clBackground can be anything (simple color, > image, gradient fill, ...) and it changes, when the user changes the > theme. So, the clWindowText must be sent to the interface, not the > current color. It is up to the interface to convert it. Of course, could have known that. Could you apply to the other part then? I have reattached the part that was important.

I applied it.
Although I think, the DC=Unused is a dirty hack. Is there any reason, to not use a flag in TWinControl?

Mattias

Reply by email

Micha Nelissen
to Micha Nelissen: Two questions. 1) The WMPaint method for TCustomForm and TScrollingWinControl are exactly…
Micha Nelissen wrote 9 lines
Hi, 2) The WM_ERASEBKGND really needs to be implemented, otherwise it will be black on windows. Delphi has: if not FDoubleBuffered or (TMessage(Message).wParam = TMessage(Message).lParam) then FillRect(Message.DC, ClientRect, FBrush.Handle); Message.Result := 1;

I have attached a patch that works on windows. These last two patches fix the TPromptDialog bug I mentioned earlier. In addition to the erase background implementation I also added color convertion routines for the font selection. I am unsure whether the interface will accept the special clBlack and such, a real RGB value is better.

Regards,

Micha.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: bin00042.bin
Type: application/octet-stream
Size: 1925 bytes
Desc: "erase_background.patch"
Url : http://localhost/pipermail/lazarus/attachments/20030629/a7626f2c/bin00042.bin

Reply by email

Mattias Gaertner
to Micha Nelissen: Two questions. 1) The WMPaint method for TCustomForm and TScrollingWinControl are exactly…
Show quoted text 16 lines
Micha Nelissen wrote: > Hi, > > 2) The WM_ERASEBKGND really needs to be implemented, otherwise it > will be black on windows. Delphi has: > > if not FDoubleBuffered or > (TMessage(Message).wParam = TMessage(Message).lParam) then > FillRect(Message.DC, ClientRect, FBrush.Handle); > Message.Result := 1; I have attached a patch that works on windows. These last two patches fix the TPromptDialog bug I mentioned earlier. In addition to the erase background implementation I also added color convertion routines for the font selection. I am unsure whether the interface will accept the special clBlack and such, a real RGB value is better.

The ColorToRGB calls were deleted with reason. System colors are theme dependent. For example clBackground can be anything (simple color, image, gradient fill, ...) and it changes, when the user changes the theme. So, the clWindowText must be sent to the interface, not the current color. It is up to the interface to convert it.

Mattias

Reply by email

Mattias Gaertner
to Micha Nelissen: Two questions. 1) The WMPaint method for TCustomForm and TScrollingWinControl are exactly…
Show quoted text 16 lines
Mattias Gaertner wrote: > On Mon, 30 Jun 2003 07:54:29 +0200 > "Micha Nelissen" wrote: > >> Could you apply to the other part then? I have reattached the part >> that was important. > > I applied it. > Although I think, the DC=Unused is a dirty hack. Is there any reason, > to not use a flag in TWinControl? Alike FNextWMEraseBkGndIsFromOurselves := true? No problem, i'd say. I just copied this code from how delphi does it. It seems FBrush is not always initialized, ie. it is nil. Can you add code to initialize it?

Added.

Mattias

Reply by email