Thread View: pl.comp.lang.pascal
1 messages
1 total messages
Started by Terrmit
Thu, 20 May 2010 22:02
[Lazarus] [Delphi?] StrToColorDef
Author: Terrmit
Date: Thu, 20 May 2010 22:02
Date: Thu, 20 May 2010 22:02
20 lines
596 bytes
596 bytes
Witam, Taka sobie prosta rzecz. Wnerwiło mnie, że StringToColor wywala błąd, gdy poda się mu bzdurną nazwę koloru (u mnie zdarzały się puste stringi). Ale skoro jest IntToStrDef, StrToFloatDef itp., to czemu nie StrToColorDef? Nieco więc "poprawiłem" StringToColor. Może komuś się przyda. function StrToColorDef(const S: shortstring; Default: TColor): TColor; begin Result := Default; if not IdentToColor(S, Longint(Result)) then Result := TColor(StrToIntDef(S, Integer(Default))); end; Jakby ktoś mógł sprawdzić, czy działa to w Delphi, bo ja nie mam. Sławek
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