Jump to content


Photo

General Repaint Problem


  • Please log in to reply
64 replies to this topic

#41 Emsländer

Emsländer
  • Members
  • 74 posts
  • Location:Germany

Posted 17 June 2006 - 11:55 AM

QUOTE (wvd_vegt @ Jun 16 2006, 05:28 PM) <{POST_SNAPBACK}>
And putting it between BeginUpdate/EndUpdate or LockWindow() calls?

A really last resort & nasty one is:

LockWindow(Handle),
Hide Mainwindow,
Code....
Show It and
LockWindow(0).

Whish i could help you out.

Btw You problem still looks like a hanging endupdate to me. Do you use that anywhere in your app?




I didn´t use any of this in my apps



rgds



Jörg



QUOTE (Boki (Berg) @ Jun 16 2006, 04:00 PM) <{POST_SNAPBACK}>
Hello,

I have compile this project in my Delphi 2006 and all work fine. Maybe I may send you Jorg current version to you test it. I don't have any more ideas sad.gif

regards




Hi Boki,



i made a fallback to Delphi 2005. And... oh Bullshit... just the same!!!! Before I changed to Delphi 2005 all was fine.



rgds



Jörg

#42 Markus

Markus
  • Members
  • 54 posts

Posted 17 June 2006 - 07:48 PM

QUOTE (Emsl�nder @ Jun 17 2006, 12:55 PM) <{POST_SNAPBACK}>
i made a fallback to Delphi 2005. And... oh Bullshit... just the same!!!! Before I changed to Delphi 2005 all was fine.


That's one reason why we're using a VCS...
It compiles, ship it!

#43 JasonColey

JasonColey
  • Honorable Members
  • 44 posts

Posted 18 June 2006 - 01:11 AM

I have now seen the problem here, with the ComboBox not paiting the dopdown list until the mouse is over it. I shall do some work to try and find out why this is happening, boki do you have later versions that I can try before I try to find the problem?

#44 JasonColey

JasonColey
  • Honorable Members
  • 44 posts

Posted 18 June 2006 - 01:52 AM

this has worked for my problem, added Repaint near the end of the procedure.

procedure TNxPopupControl.Popup(X, Y: Integer);
var
HCurrMonitor: HMONITOR;
MonitorInf: MONITORINFO;
R: TRect;
MonitorWidth: Integer;
begin
with FOwner as TNxCustomEdit do R := Rect(X, Y, X + Width, Y + Height);
HCurrMonitor := MonitorFromRect(@R, MONITOR_DEFAULTTONEAREST);
MonitorInf.cbSize := SizeOf(MonitorInf);
GetMonitorInfo(HCurrMonitor, @MonitorInf);

MonitorWidth := MonitorInf.rcWork.BottomRight.X;
if X + Width > MonitorWidth then
X := X - (X + Width - MonitorWidth);

if X < 0 then X := 0;
SetWindowPos(Handle, HWND_TOP, X, Y, Width, Height, SWP_SHOWWINDOW);
DropMode := dmOpen;
FFullOpened := False;
Visible := True;
SetCaptureControl(Self);
Repaint;
Windows.SetFocus(Handle)
end;

#45 Emsländer

Emsländer
  • Members
  • 74 posts
  • Location:Germany

Posted 21 June 2006 - 04:16 PM

QUOTE (JasonColey @ Jun 18 2006, 02:52 AM) <{POST_SNAPBACK}>
this has worked for my problem, added Repaint near the end of the procedure.

procedure TNxPopupControl.Popup(X, Y: Integer);
var
HCurrMonitor: HMONITOR;
MonitorInf: MONITORINFO;
R: TRect;
MonitorWidth: Integer;
begin
with FOwner as TNxCustomEdit do R := Rect(X, Y, X + Width, Y + Height);
HCurrMonitor := MonitorFromRect(@R, MONITOR_DEFAULTTONEAREST);
MonitorInf.cbSize := SizeOf(MonitorInf);
GetMonitorInfo(HCurrMonitor, @MonitorInf);

MonitorWidth := MonitorInf.rcWork.BottomRight.X;
if X + Width > MonitorWidth then
X := X - (X + Width - MonitorWidth);

if X < 0 then X := 0;
SetWindowPos(Handle, HWND_TOP, X, Y, Width, Height, SWP_SHOWWINDOW);
DropMode := dmOpen;
FFullOpened := False;
Visible := True;
SetCaptureControl(Self);
Repaint;
Windows.SetFocus(Handle)
end;




I already got a version from boki, where this is installed.



But this version makes problems in D2005, too !!:



Here without repaint



1. I chose a line, click on scoring (the scoring need ca. 0,5 to 1 second)





when the scoring process is finished, the 2. tab will be set visible:







You can see the shit.

Now I click on another tab an back(in the same TXnPageControl) to this one:







now I can chose a line ..













...and click on "Auswahl" (This process is very fast, only filling a grid): (The next tab should be visible):









Bullshit. Here too, I click to another tab and back to this one and I can see all:







Here now the scoring with repaint:







Again Bullshit - only one line of four is visible. And its not clickable. A click on another tab and back to this one:







now I can see all four lines and also click onto ....



@Boki & Jason: Hope that you get fixed this soon ....



brgds



Jörg

#46 JasonColey

JasonColey
  • Honorable Members
  • 44 posts

Posted 21 June 2006 - 11:02 PM

The buttons that are navigating from one tab to another what code are they using, it seems the manual way to move from tab to tab is ok, just the programmatic way, is that correct?\

#47 Emsländer

Emsländer
  • Members
  • 74 posts
  • Location:Germany

Posted 22 June 2006 - 12:11 AM

QUOTE (JasonColey @ Jun 22 2006, 12:02 AM) <{POST_SNAPBACK}>
The buttons that are navigating from one tab to another what code are they using, it seems the manual way to move from tab to tab is ok, just the programmatic way, is that correct?\




Hi Jason,


so it is. AFAIK it is a timing problem


brgds



Jörg

#48 JasonColey

JasonColey
  • Honorable Members
  • 44 posts

Posted 22 June 2006 - 09:09 AM

How are you changing the activetab, are you using the ActivePageIndex?

Like when you click "Auswahl" are you setting the activepageindex, what is this code doing to change the visible page?

Are the pages visible in design time or are they being set to invisible when the form is created or shown?

#49 Emsländer

Emsländer
  • Members
  • 74 posts
  • Location:Germany

Posted 22 June 2006 - 09:28 AM

QUOTE (JasonColey @ Jun 22 2006, 10:09 AM) <{POST_SNAPBACK}>
How are you changing the activetab, are you using the ActivePageIndex?

Like when you click "Auswahl" are you setting the activepageindex, what is this code doing to change the visible page?

Are the pages visible in design time or are they being set to invisible when the form is created or shown?




In design time all is visible. During programm start the tab are set as invisible (PageVisible := false)



in oncreate the tab are set invisible



When I click on "scoring" the the computer does a scoring. This needs about 0,5 to 1 sec. If this is ok, the tab Finanzierung is set to visible (I also tried with additional repaint, too).

When I click on "auswahl" then the computer fills a grid an the tab Finanzierungsvorschlag ist set to visible. (I also tried with additional repaint, too).



I´m glad to see, that somebody tries to solve the problem. Thanks



brgds



Jörg

#50 JasonColey

JasonColey
  • Honorable Members
  • 44 posts

Posted 22 June 2006 - 09:31 AM

If you can send me a test app with the problem in it, I can test this in BDS2006 and BDS2005 ( I can install this on an older machine and do a test compile)

#51 Emsländer

Emsländer
  • Members
  • 74 posts
  • Location:Germany

Posted 22 June 2006 - 10:01 AM

QUOTE (JasonColey @ Jun 22 2006, 10:31 AM) <{POST_SNAPBACK}>
If you can send me a test app with the problem in it, I can test this in BDS2006 and BDS2005 ( I can install this on an older machine and do a test compile)




Hi Jason,



in a small test app all works fine. And this big application you cannot compile, because you don´t have all the libs.



It seems to be a timing problem. In the march/april release of the bergsuite there was no problem with this.



pls. send me an email... perhaps we can do something remote?



brgds



Jörg

#52 wvd_vegt

wvd_vegt

    Master Member

  • Honorable Members
  • PipPipPipPipPip
  • 710 posts
  • Gender:Male
  • Location:the Netherlands

Posted 22 June 2006 - 03:50 PM

Hi,

Question, does it also occur if you don't use visibilty of the tabs? So show them all and only jump between them?
G.W. van der Vegt

#53 Emsländer

Emsländer
  • Members
  • 74 posts
  • Location:Germany

Posted 22 June 2006 - 04:25 PM

QUOTE (wvd_vegt @ Jun 22 2006, 04:50 PM) <{POST_SNAPBACK}>
Hi,

Question, does it also occur if you don't use visibilty of the tabs? So show them all and only jump between them?






I just tried it: Yes it does, so I think, the problem is anywhere in set ...ActivePage := ....







Rgds



Jörg

#54 wvd_vegt

wvd_vegt

    Master Member

  • Honorable Members
  • PipPipPipPipPip
  • 710 posts
  • Gender:Male
  • Location:the Netherlands

Posted 22 June 2006 - 06:49 PM

Hi Jörg,

Next thing to try is disable the ActivePage and do it by mouse (and see if that repaints any better).

Btw in:

CODE
procedure TNxNotebook.SetActivePage(const Value: TNxTabSheet);


I find one of the last lines very suspect:

CODE
if AOldIndex >= 0 then RefreshPage(AOldIndex);


I would personally remove/comment it as you should not repaint the old page.
G.W. van der Vegt

#55 Emsländer

Emsländer
  • Members
  • 74 posts
  • Location:Germany

Posted 22 June 2006 - 09:50 PM

QUOTE (wvd_vegt @ Jun 22 2006, 07:49 PM) <{POST_SNAPBACK}>
Hi Jörg,

Next thing to try is disable the ActivePage and do it by mouse (and see if that repaints any better).


this works fine ....

QUOTE
Btw in:

CODE
procedure TNxNotebook.SetActivePage(const Value: TNxTabSheet);


I find one of the last lines very suspect:

CODE
if AOldIndex >= 0 then RefreshPage(AOldIndex);


I would personally remove/comment it as you should not repaint the old page.




makes no difference


Btw: I found something suspect.



If I make only:



CODE
    frmMain.pc_Finanzierung.ActivePageindex := 1;




the result is ok. The Panel (the content) of tab1 is shown. - Only the tab itself is not visible.

if i add:

CODE
frmmain.tab_finanzierung_finanzierung.PageVisible := true;


to this, I see the tab, and the rest is the same shit as before .... (and its the same also if I do it before or after ...ActivePageindex := 1;


Add. Comment: It has something to do with PageVisible ! Only if this statement is used, the result is shit....

brgds

Jörg

#56 wvd_vegt

wvd_vegt

    Master Member

  • Honorable Members
  • PipPipPipPipPip
  • 710 posts
  • Gender:Male
  • Location:the Netherlands

Posted 22 June 2006 - 11:12 PM

Hi Jörg.

In method:
CODE
TNxTabSheet.SetPageVisible

there is a statement i would change:
CODE
Visible:=False;

into:
CODE
Visible:=Value;

or even remove it. It seems a bit strange to set it to false no matter what the value is. Visible is a property of the TCustomControl , not the TNxTabSheet.

I Just tried it with a simple loop (3 tabs each with a TImage & Large picture on it):
CODE
for i:=0 to 100 do
  begin
    Pc.Pages[Random(Pc.PageCount)].PageVisible:=not Pc.Pages[Random(Pc.PageCount)].PageVisible;
    Repaint;
  end;

and with the original code the pages don't paint at all until you click a tab.
When changed into:
CODE
Visible :=Value

They paint correctly!

Only artifacts remaining with this code are that
1) sometimes the leftmost tab is partially clipped if there is no active tab (ie the leftmost is tab 2 and the active tab tab 1 and is hidden).
2) when all tabs are hidden the client area isn't cleaned so the last visible image stays visible.

Anyway the code exhibits painting problems that are solved with the small change.

Btw Jörg could you use a bit less returns keys? It makes your postings more readable.
G.W. van der Vegt

#57 Emsländer

Emsländer
  • Members
  • 74 posts
  • Location:Germany

Posted 23 June 2006 - 01:35 AM

QUOTE (wvd_vegt @ Jun 23 2006, 12:12 AM) <{POST_SNAPBACK}>
Hi Jörg.

In method:
CODE
TNxTabSheet.SetPageVisible

there is a statement i would change:
CODE
Visible:=False;

into:
CODE
Visible:=Value;

or even remove it. It seems a bit strange to set it to false no matter what the value is. Visible is a property of the TCustomControl , not the TNxTabSheet.

I Just tried it with a simple loop (3 tabs each with a TImage & Large picture on it):
CODE
for i:=0 to 100 do
  begin
    Pc.Pages[Random(Pc.PageCount)].PageVisible:=not Pc.Pages[Random(Pc.PageCount)].PageVisible;
    Repaint;
  end;

and with the original code the pages don't paint at all until you click a tab.
When changed into:
CODE
Visible :=Value

They paint correctly!

Only artifacts remaining with this code are that
1) sometimes the leftmost tab is partially clipped if there is no active tab (ie the leftmost is tab 2 and the active tab tab 1 and is hidden).
2) when all tabs are hidden the client area isn't cleaned so the last visible image stays visible.

Anyway the code exhibits painting problems that are solved with the small change.

Btw Jörg could you use a bit less returns keys? It makes your postings more readable.






Hi,



your solution works! Great job!

Many many thanks - If we meet us anywhere: The bill in the bar is my!



brgds



Jörg

#58 wvd_vegt

wvd_vegt

    Master Member

  • Honorable Members
  • PipPipPipPipPip
  • 710 posts
  • Gender:Male
  • Location:the Netherlands

Posted 23 June 2006 - 01:57 AM

Hi Jörg,

Really glad to hear your repaint problem is finally solved. Glad to be of help.

Now the hardest part, I have to find you in a bar.....

Have a nice weekend and good luck with your upcoming release!
G.W. van der Vegt

#59 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 23 June 2006 - 02:22 AM

Hello Wim,

Thank you very much! I don't know how I have skip this line sad.gif

I have rewrite this method into:

CODE
procedure TNxTabSheet.SetPageVisible(const Value: Boolean);
begin
  FPageVisible := Value;
  if FPageControl <> nil then
  begin
    Visible := Value and (FPageControl.ActivePage = Self);
    FPageControl.Invalidate;
  end else Visible := False;
end;


CODE
procedure TNxNotebook.SetActivePage(const Value: TNxTabSheet);
var
  AOldIndex, ANewIndex: Integer;
  AllowChange: Boolean;
begin
  if csDestroying in ComponentState then Exit;
  if (Value = FActivePage) then Exit;
  if Assigned(FActivePage) then
  begin
    FActivePage.Hide;
    AOldIndex := FActivePage.PageIndex;
  end else AOldIndex := -1;
  if Assigned(Value) then
  begin
    AllowChange := True;
    if not(csLoading in ComponentState)
      then DoChanging(Value.PageIndex, AllowChange); { event }
    if (AllowChange = False) or (Value.PageControl <> Self) then Exit;
    FActivePage := Value;
    if FActivePage.PageVisible then // <--- new
    begin
      FActivePage.Show;
      FActivePage.BringToFront;
    end;
    FActivePageIndex := FPageList.IndexOf(Value);
    ANewIndex := FActivePage.PageIndex;
    if ANewIndex >= 0 then RefreshPage(FActivePage.PageIndex);
  end else
  begin
    FActivePage := nil;
  end;
  if AOldIndex >= 0 then RefreshPage(AOldIndex);
  if not(csDestroying in ComponentState) then DoChange; { event }
end;


I suggest Jorg that you try it too.

regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#60 wvd_vegt

wvd_vegt

    Master Member

  • Honorable Members
  • PipPipPipPipPip
  • 710 posts
  • Gender:Male
  • Location:the Netherlands

Posted 23 June 2006 - 09:42 AM

Hi Boki,

As usual no problem. These kind of bug are hard to find (I make them oo). The harder you look, the more you overlook them. I'll try the new code.

Btw does the proposed code also solve the slight repaint (clipped left tab corner) problem at the left side of the tabs when the active tab is invisible?
G.W. van der Vegt




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users