Autor Beitrag
Martok
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: Sa 09.09.06 00:38 
Hallo,

ich möchte den Online-Status als Speedbutton-Glyph anzeigen.
Dazu nutze ich folgenden Code:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TdmGlobals.UpdateStatus;
var idx:integer;
begin
  if ICQ.LoggedIn then
    idx:= StatusToImageIndex(ICQ.Status)
  else
    idx:= StatusToImageIndex(S_OFFLINE);
  ilStatus.GetBitmap(idx,fmContacts.sbStatus.Glyph);
end;


Beim ersten mal (Programmstart) ist er logischerweise noch nicht LoggedIn, daher bekomme ich das Offline-Bild(Index 6).
Wenn ich Online gehe, kommt er in den ersten Zweig und errechnet den richtigen ImageIndex(Index 0). Trotzdem passiert mit dem Glyph nichts. Es wird weiterhin das Offline-Bild angezeigt.

Am SpeedButton liegts nicht, ich hab schon mit TImage getestet. Aber woran liegt das dann? Der Normalzustand kann das ja wohl nicht sein :?

Danke,
Martok

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
Martok Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: Sa 09.09.06 23:40 
Hm, ich hab jetzt einen Workaround, aber komisch ist es trotzdem.
GetBitmap funktioniert nur, wenn das Bitmap leer war. Warum weiß ich nicht, auch im Source von TImageList hab ich nichts seltsames gefunden. Kennt sich jemand damit aus?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
procedure TdmGlobals.UpdateStatus;
var idx:integer;
begin
  if ICQ.LoggedIn then
    idx:= StatusToImageIndex(ICQ.Status)
  else
    idx:= StatusToImageIndex(S_OFFLINE);

  //Glyph erst löschen
  fmContacts.sbStatus.Glyph.Assign(nil);

  ilStatus.GetBitmap(idx,fmContacts.sbStatus.Glyph);
end;

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
hochmohr
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 23.09.06 09:15 
Hallo,

ich hatte das gleiche Problem mit einem TImage.

Ein Refresh nach der Zuweisung hat es gelöst.

Gruß,

Thomas