Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Farbwahl bei PALM (https://www.delphipraxis.net/19387-farbwahl-bei-palm.html)

yogie 2. Apr 2004 07:13


Farbwahl bei PALM
 
Hallo zusammen,

weiß jemand wie man beim PALM die Zeichefarbe für Linien wechselt.
Verwendet wird WINSOFT Pocke Studio 2.0.

Danke

negaH 2. Apr 2004 14:53

Re: Farbwahl bei PALM
 
Hängt vom OS ab, da das OS lange Zeit garkeine Farben unterstützte.
Um es teilweise OS unabhängig zu machen habe ich mir folgende Routinen gecodet:

Delphi-Quellcode:
function CheckROMVersion(RequiredVersion: UInt32): Boolean;
var
  RomVersion: UInt32;
begin
  FtrGet(sysFtrCreator, sysFtrNumROMVersion, RomVersion);
  Result := RomVersion >= RequiredVersion;
end;

function WinSetFgColor(FgColor: IndexedColorType): IndexedColorType;
type
  TWinSetForeColor = function(foreColor: IndexedColorType): IndexedColorType;
var
  P: Pointer;
begin
  if CheckROMVersion($03503000) then
  begin
    P := SysGetTrapAddress(sysTrapWinSetForeColor);
    Result := TWinSetForeColor(P)(FgColor);
  end else Result := FgColor;
end;

function WinSetBkColor(BkColor: IndexedColorType): IndexedColorType;
type
  TWinSetBackColor = function(backColor: IndexedColorType): IndexedColorType;
var
  P: Pointer;
begin
  if CheckROMVersion($03503000) then
  begin
    P := SysGetTrapAddress(sysTrapWinSetBackColor);
    Result := TWinSetBackColor(P)(BkColor);
  end else Result := BkColor;
end;

function WinSetTxColor(TxColor: IndexedColorType): IndexedColorType;
type
  TWinSetTextColor = function(textColor: IndexedColorType): IndexedColorType;
var
  P: Pointer;
begin
  if CheckROMVersion($03503000) then
  begin
    P := SysGetTrapAddress(sysTrapWinSetTextColor);
    Result := TWinSetTextColor(P)(TxColor);
  end else Result := TxColor;
end;

function ColorIndex(ColorIndex: UIColorTableEntries): IndexedColorType;
type
  TUIColorGetTableEntryIndex = function(which: UIColorTableEntries): IndexedColorType;
var
  P: Pointer;
begin
  if CheckROMVersion($03503000) then
  begin
    P := SysGetTrapAddress(sysTrapUIColorGetTableEntryIndex);
    Result := TUIColorGetTableEntryIndex(P)(ColorIndex);
  end else Result := 0;
end;

procedure Test;
var
  C: IndexedColorType;
begin
  C := WinSetFgColor(ColorIndex(UIFieldTextLines));
  WinDrawGrayLine(0, 10, 160, 10);
  WinSetFgColor(C);
end;
Wie man sieht wird beim Palm OS von einem Object-Farbindex der in eine Object-Farb-Tabelle zeigt in einen Device-Farbindex der in eine Device-Farb-Tabelle zeigt in den realen Farbwert konvertiert. Also eigentlich ziemlich bescheuert.

Gruß Hagen

yogie 5. Apr 2004 09:26

Re: Farbwahl bei PALM
 
besten Dank für die Infos,

eine Suche bei google und co hatte mich nicht weitergebracht,
ich werde jetzt mal probieren ob ich damit klarkomme.


Alle Zeitangaben in WEZ +1. Es ist jetzt 17:34 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz