Thread View: comp.lang.pascal.delphi.misc
3 messages
3 total messages
Started by Rob Wilson
Thu, 05 Feb 1998 00:00
Strange NT problems with D1 and TImage.Canvas Methods PLEASE HELP!!
Author: Rob Wilson
Date: Thu, 05 Feb 1998 00:00
Date: Thu, 05 Feb 1998 00:00
128 lines
5146 bytes
5146 bytes
Hi,
Unfortunately I was not too sure which newsgroup would be best for
this problem, so I have cross-posted to many.
I appologise if I have 'over' posted.
I have been using Delphi 1 to ensure 16 bit windows compatibility and
have been developing in windows 95 environment with NO problems at
all.
Today I have moved to an NT workstation and copied my project over and
use Delphi 1 still as the target is still 16 bit.... BUT one of my
forms contiuously updates when it is run on an NT but NOT on 3.11 (and
not on WIN95 at home)....
I have a snippet of my code, which you can really ignore everything
except the area shown in ******'s.
The ListBox1 is used for debugging, and on Win3.11 just displays
"Form Update Number 1" and stops, ready for user input
On the NT, this is repeated non-stop and doesn't allow the user to
have any input.
When I remove the bit of code in the ****'s, it stops refreshing, but
its the heart of the draw operation..... Strangely enough, the listbox
says its been called twice..... Why? Is this the start of my problem?
DOES ANYONE KNOW WHATS WRONG!!!???
Please help, any ideas would be appreciated.
Code follows:-
procedure TFormOverlay.FormPaint(Sender: TObject);
var
colorloop : integer;
gap : integer;
x,y : integer;
MaxOverlayX,MaxOverlayY : integer;
StartX,StartY : integer;
begin
inc(FormUpdateCount);
ListBox1.ItemIndex:=ListBox1.Items.Add('Form update number
'+inttostr(FormUpdateCount));
ListBox1.Refresh;
{Is there a better time/place for this?}
OverlayNumberOfColours:=NumberOfColours;
{Do I need to copy palette from bitmap 1 ?}
gap:=FormOverlay.ImageColorPalette.Width div NumberOfColours;
ImageColorPalette.Canvas.Brush.Style:=BSSolid;
for colorloop:=0 to NumberOfColours-1 do
begin
ImageColorPalette.Canvas.Pen.Color:=ColourInfo[ColorLoop].ColourRef;
ImageColorPalette.Canvas.Brush.Color:=ColourInfo[ColorLoop].ColourRef;
{
ImageColorPalette.Canvas.FillRect(rect(colorloop*gap,0,(colorloop*gap)+gap,imagecolorpalette.height));
ImageOverlay.Refresh;
{Palette information copied to overlay when drawing, to
ensure always
up-to-date without calling a function}
OverlayPalette[colorloop]:=ColourInfo[ColorLoop].ColourRef;
end;
MaxOverlayX:=ImageOverlay.Width div (CurrentZoom.Progress*3);
MaxOverlayY:=ImageOverlay.Height div (CurrentZoom.Progress*3);
startx :=OverlayScrollBarX.Position;
starty :=OverlayScrollBarY.Position;
for y:=0 to MaxOverlayY do
begin
for x:=0 to MaxOverlayX do
begin
if (startx+x > formmain.image1.width) or (starty+y >
formmain.image1.height) then
begin
{Debug.Items.Add('Image 1
width='+inttostr(image1.width)+height'}
end
else
begin
ImageOverlay.Canvas.Pen.Color:=FormMain.Image1.Canvas.Pixels[startx+x,starty+y]
AND $00FFFFFF;
ImageOverlay.Canvas.Brush.Color:=FormMain.Image1.Canvas.Pixels[startx+x,starty+y]
AND $00FFFFFF;
{****************************}
{****************************}
{****************************}
{THIS BIT CAUSES DRAW EVENT TO HAPPEN
AGAIN,AGAIN,AGAIN!!!
BUT ONLY ON NT!!!? NOT 3.11 DELPHI 1 ???
HEEEEELLLLPPPP!}
ImageOverlay.Canvas.Rectangle
(x*(CurrentZoom.Progress*3),y*(CurrentZoom.Progress*3),
(x+1)*(CurrentZoom.Progress*3),(y+1)*(CurrentZoom.Progress*3));
{****************************}
{****************************}
{****************************}
end;
end;
if (y mod 5 = 0) then
begin
ImageOverlay.Refresh;
end;
end;
end;
Re: Strange NT problems with D1 and TImage.Canvas Methods PLEASE HELP!!
Author: Dmitry Streblechenko
Date: Fri, 06 Feb 1998 00:00
Date: Fri, 06 Feb 1998 00:00
134 lines
5695 bytes
5695 bytes
Rob, I had a similar problem: you cause window
updates from within your paint handler (ImageOverlay.Refresh ?)
Win95 handles such situations better than NT.
Dmitry
Rob Wilson wrote:
>
> Hi,
>
> Unfortunately I was not too sure which newsgroup would be best for
> this problem, so I have cross-posted to many.
>
> I appologise if I have 'over' posted.
>
> I have been using Delphi 1 to ensure 16 bit windows compatibility and
> have been developing in windows 95 environment with NO problems at
> all.
>
> Today I have moved to an NT workstation and copied my project over and
> use Delphi 1 still as the target is still 16 bit.... BUT one of my
> forms contiuously updates when it is run on an NT but NOT on 3.11 (and
> not on WIN95 at home)....
>
> I have a snippet of my code, which you can really ignore everything
> except the area shown in ******'s.
>
> The ListBox1 is used for debugging, and on Win3.11 just displays
>
> "Form Update Number 1" and stops, ready for user input
>
> On the NT, this is repeated non-stop and doesn't allow the user to
> have any input.
>
> When I remove the bit of code in the ****'s, it stops refreshing, but
> its the heart of the draw operation..... Strangely enough, the listbox
> says its been called twice..... Why? Is this the start of my problem?
>
> DOES ANYONE KNOW WHATS WRONG!!!???
>
> Please help, any ideas would be appreciated.
>
> Code follows:-
>
> procedure TFormOverlay.FormPaint(Sender: TObject);
> var
> colorloop : integer;
> gap : integer;
> x,y : integer;
> MaxOverlayX,MaxOverlayY : integer;
> StartX,StartY : integer;
> begin
> inc(FormUpdateCount);
> ListBox1.ItemIndex:=ListBox1.Items.Add('Form update number
> '+inttostr(FormUpdateCount));
> ListBox1.Refresh;
>
> {Is there a better time/place for this?}
> OverlayNumberOfColours:=NumberOfColours;
>
> {Do I need to copy palette from bitmap 1 ?}
> gap:=FormOverlay.ImageColorPalette.Width div NumberOfColours;
>
> ImageColorPalette.Canvas.Brush.Style:=BSSolid;
> for colorloop:=0 to NumberOfColours-1 do
> begin
>
> ImageColorPalette.Canvas.Pen.Color:=ColourInfo[ColorLoop].ColourRef;
>
> ImageColorPalette.Canvas.Brush.Color:=ColourInfo[ColorLoop].ColourRef;
>
> {
>
> ImageColorPalette.Canvas.FillRect(rect(colorloop*gap,0,(colorloop*gap)+gap,imagecolorpalette.height));
> ImageOverlay.Refresh;
>
> {Palette information copied to overlay when drawing, to
> ensure always
> up-to-date without calling a function}
> OverlayPalette[colorloop]:=ColourInfo[ColorLoop].ColourRef;
> end;
>
> MaxOverlayX:=ImageOverlay.Width div (CurrentZoom.Progress*3);
> MaxOverlayY:=ImageOverlay.Height div (CurrentZoom.Progress*3);
>
> startx :=OverlayScrollBarX.Position;
> starty :=OverlayScrollBarY.Position;
>
> for y:=0 to MaxOverlayY do
> begin
> for x:=0 to MaxOverlayX do
> begin
> if (startx+x > formmain.image1.width) or (starty+y >
> formmain.image1.height) then
> begin
> {Debug.Items.Add('Image 1
> width='+inttostr(image1.width)+height'}
> end
> else
> begin
>
> ImageOverlay.Canvas.Pen.Color:=FormMain.Image1.Canvas.Pixels[startx+x,starty+y]
> AND $00FFFFFF;
>
> ImageOverlay.Canvas.Brush.Color:=FormMain.Image1.Canvas.Pixels[startx+x,starty+y]
> AND $00FFFFFF;
>
> {****************************}
> {****************************}
> {****************************}
> {THIS BIT CAUSES DRAW EVENT TO HAPPEN
> AGAIN,AGAIN,AGAIN!!!
> BUT ONLY ON NT!!!? NOT 3.11 DELPHI 1 ???
> HEEEEELLLLPPPP!}
>
> ImageOverlay.Canvas.Rectangle
>
> (x*(CurrentZoom.Progress*3),y*(CurrentZoom.Progress*3),
>
> (x+1)*(CurrentZoom.Progress*3),(y+1)*(CurrentZoom.Progress*3));
>
> {****************************}
> {****************************}
> {****************************}
>
> end;
> end;
> if (y mod 5 = 0) then
> begin
> ImageOverlay.Refresh;
> end;
> end;
> end;
Re: Strange NT problems with D1 and TImage.Canvas Methods PLEASE HELP!!
Author: Rob Wilson
Date: Mon, 09 Feb 1998 00:00
Date: Mon, 09 Feb 1998 00:00
25 lines
1853 bytes
1853 bytes
On Fri, 06 Feb 1998 22:55:15 -0700, Dmitry Streblechenko <dmitrys@asu.edu> wrote: >Rob, I had a similar problem: you cause window >updates from within your paint handler (ImageOverlay.Refresh ?) >Win95 handles such situations better than NT. > >Dmitry > >Rob Wilson wrote: <snip> Actually, it seems to be the Rectangle or any drawing operation on the Canvas that seems to cause the problem. The ImageOverlay.Refresh didn't seem to cause the problem. If I Rem'd out the Rectange (or fill rect which it originally was), the routine doesn't keep drawing the window. Any ideas? Thanks for your reply... What was your work-around!? Rob.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads