Entwickler-Ecke

Grafische Benutzeroberflächen (VCL & FireMonkey) - Progressbarfarbe XE4


Jakane - Do 19.09.13 10:19
Titel: Progressbarfarbe XE4
Hallo liebe Delphi-Helfer :)

meine Progressbar ist und bleibt grün egal was ich mache :(


Delphi-Quelltext
1:
2:
3:
4:
PostMessage(PB.Handle, $04090, clRed);
SendMessage(PB.Handle, $04090, clRed);
PB.BarColor := clRed;
PB.Perform($04090, clRed);


Die XE4 Hilfe ist auch zum **** xD

Hoffe jemand weiss rat ^^


baumina - Do 19.09.13 10:41

Das liegt an der Projekt-Einstellung "Laufzeit-Themes aktivieren". Entweder Du deaktivierst das ganz für dein Projekt unter "Projekt/Optionen/Anwendung" oder nur für die Progressbar z.B. im FormShow folgendermaßen:


Delphi-Quelltext
1:
2:
3:
4:
5:
6:
uses uxTheme

if uxTheme.IsThemeActive then
begin
  uxTheme.SetWindowTheme(PB.Handle, '''');
end;


Delete - Do 19.09.13 11:40

XPMAN entfernen.


Jakane - Do 19.09.13 12:34

Na wenn ich soweit gehe bringt mich mein Chef um :D

Aber danke für die Info :)


jaenicke - Do 19.09.13 17:21

Laut den Design Guidelines für Windows hat die Farbe der Progressbar eine Bedeutung und sollte situationsgerecht genutzt werden (macht finde ich wie angegeben auch Sinn):
http://msdn.microsoft.com/en-us/library/windows/desktop/aa511486.aspx hat folgendes geschrieben:
Progress bar colors
Use red or yellow progress bars only to indicate the progress status, not the final results of a task. A red or yellow progress bar indicates that users need to take some action to complete the task. If the condition isn't recoverable, leave the progress bar green and display an error message.

Turn the progress bar red when there is a user recoverable condition that prevents making further progress. Display a message to explain the problem and recommend a solution.

Turn the progress bar yellow to indicate either that the user has paused the task or that there is a condition that is impeding progress but progress is still taking place (as, for example, with poor network connectivity). If the user has paused, change the Pause button label to Resume. If progress is impeded, display a message to explain the problem and recommend a solution.

Setzen kannst du diesen Status dann entsprechend:

Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
const
  PBM_SETSTATE = WM_USER + 16;
  PBM_GETSTATE = WM_USER + 17;

  PBST_NORMAL = $0001;
  PBST_ERROR = $0002;
  PBST_PAUSED = $0003;
begin
  ProgressBar1.Perform(PBM_SETSTATE, PBST_ERROR, 0); // Fehler, den der User durch eine Aktion korrigieren kann
  ProgressBar1.Perform(PBM_SETSTATE, PBST_PAUSED, 0); // Rückfrage vom User muss für den weiteren Fortschritt beantwortet werden