Autor Beitrag
OsCor
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55

Win XP, Win 7 (32)
Delphi 2007 Prof, RAD Studio XE2
BeitragVerfasst: Mo 06.02.12 17:32 
Hallo!

D2007
die User meiner Anwendung sollen per Änderung der Caption-Eigenschaft eines speziellen Tabs (fett/farbig) auf ein im Hintergrund auftretendes Ereignis aufmerksam gemacht werden.
Das klappt bei mir aber nur, wenn dieses Ereignis vor dem Start der Anwendung schon statt gefunden hat.
Ich weiß nämlich nicht, wie ich zwischendurch das Ereignis OnDrawTab auslösen und damit meine Caption ändern kann. Bei einem Wechsel des aktiven Tabsheets wird das Ereignis scheinbar nicht ausgelöst. Nur beim Programmstart und wenn man explizit auf den Reiter drückt.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
procedure TForm1.PageControl1DrawTab(Control: TCustomTabControl;
  TabIndex: Integer; const Rect: TRect; Active: Boolean);
begin
    if (TabIndex=6and (vf.Count > 0then
      begin
           Control.Canvas.FillRect(Rect);
           Control.Canvas.Font.Style := [fsBold];
           Control.Canvas.Font.Color := clBlue;
      end
      else if (TabIndex=6and (vf.Count = 0then
      begin
          Control.Canvas.FillRect(Rect);
          Control.Canvas.Font.Style := [];
          Control.Canvas.Font.Color := clBlack;
      end;
   Control.Canvas.TextOut(rect.Left +4, rect.Top+4,TPageControl(Control).Pages[TabIndex].Caption);
end;


Hat jemand eine Idee oder kann mir vom Schlauch runterhelfen?

Oswald
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19312
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 06.02.12 17:42 
Funktioniert <DeinPageControl>.Invalidate nicht?
OsCor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55

Win XP, Win 7 (32)
Delphi 2007 Prof, RAD Studio XE2
BeitragVerfasst: Mo 06.02.12 18:04 
Ich versuche gerade, in der Hilfe Auskunft darüber zu erhalten, was Invalidate genau tut, finde aber nichts.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19312
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 06.02.12 18:29 
Invalidate benachrichtigt Windows darüber, dass das Control (oder ein Bereich) neu gezeichnet werden muss. Es macht daher den Inhalt "ungültig". ;-)
OsCor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55

Win XP, Win 7 (32)
Delphi 2007 Prof, RAD Studio XE2
BeitragVerfasst: Di 07.02.12 17:18 
So. Endlich bin ich dazu gekommen, dieses Invalidate auszuprobieren: Es klappt! Hurra!
Natürlich gibt es auch noch andere Möglichkeiten, die Alarmierung eines Users zu bewerkstelligen. Aber wenn man eine Möglichkeit mal als ultimatives Mittelding zwischen Erschrecken und bloßem Anstupsen betrachtet, mag man nur ungern davon lassen :)

Ganz nebenbei habe ich noch einiges über das Hilfesystem gelernt. Leider fehlt mir zu einer ausgedehnten Safari darin die Zeit - und die braucht man alleine schon, um das Hilfesystem überhaupt zu verstehen.

Vielen Dank, Sebastian!
Oswald
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19312
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Di 07.02.12 17:47 
Intern benutzt Invalidate die API-Funktion InvalidateRect, die du in der Doku findest:
msdn.microsoft.com/e...ibrary/dd145002.aspx