Hi the VrMatrix component has some character decode issues.
It cannot display correctly the ŐŰőű characters. I tried several tricks (converting between codepages, between unicode and ansistring, etc) nothing helps.
They are single byte Hungarian characters.
Even when I trying to set in the object inspector not working too.
Seems like only 256 characters are mapped.
fi, Ord(‘ű’) gives me 369. I’m afraid it’ll light random leds.
Yes, but it is enough. I feed the matrix with ANSI encoded string (windows-1250, or ISO-8859-2 (Latin 2). There is only 8bit characters. And the same program is working ok with Windows 7 and like. The problems start with Win 10 and Win11.
I checked the vrmatrix source and it is using AnsiUpper AnsiLower and the internal representation is string. So it theoretically expects Ansi encoded string and it is getting ansi encoded string.
All leds on/off states are (manually) mapped through the CharState array (7 led rows / char), and it only maps 0-255, 8bit characters. I’m also using Windows 11, and ‘ű’ maps to 369. Char type represents a 16bit char, so ord(Ch) may return numbers greater than 8bits. By using this result as an index (Ord(Ch) * 7), it goes beyond CharState normal content, so the visual result is quite random.
‘ű’ may be ord 251 in your codepage/ansi 8bit. In my codepage, 251 ansi 8bit character is ‘û’, slightly different, and VrMatrix can handle this.
As CharState is manually mapped, are you sure it shows the accurate characters you’re using in windows 7 ? Could you check what is ord(‘ű’) when you run windows 7, and if matrix shows ű or û ?
You may also add this to your FormCreate event and check them all :
begin
var LN : integer;
var LY : integer;
Self.VertScrollBar.Visible := True;
Self.AutoScroll := True;
LY := 10;
for LN := 0 to 255 do begin // values > 255 result in random views
with TLabel.Create(Self) do begin
Parent := Self;
Top := LY;
Left := 50;
Width := 45;
AutoSize := False;
Alignment := taRightJustify;
Caption := LN.ToString;
end;
with TVrMatrix.Create(Self) do begin
Parent := Self;
Top := LY;
Left := 100;
LedStyle := ls19x27;
TextStyle := tsAsIs;
Text := ' ' + chr(LN);
Inc(LY, Height + 3);
end;
end;
end;
Hi, thanks for the tips.
The only way to display correctly a constant of a string from database (even when the IDE setup for ANSI, and the database is a legacy data also ANSI) an awkward conversion like this.
For this is crucial to setup IDE for UTF8 encoding, otherways the string literal is not as it seems 
function convertUTF8to1250(const instr: String): String;
var
inbytes : TBytes;
outbytes: TBytes;
i : integer;
begin
inbytes := TEncoding.utf8.GetBytes(instr);
outbytes := Tencoding.convert(Tencoding.UTF8,
TEncoding.GetEncoding('Windows-1250'), inbytes);
for i := Low(outbytes) to High(outbytes) do begin
Result := Result + chr(outbytes[i]);
end;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
var vrMx : TVrMAtrix;
begin
vrmx := TVrMAtrix.Create(self);
vrmx.Parent := self;
vrmx.top := 10 ;
vrmx.left := 100;
vrmx.LedStyle := ls19x27;
vrmx.TextStyle := tsAsIs;
vrmx.Leds := 20;
vrmx.Text := convertUTF8to1250('áíűüőöúóé ÁÍŰÜŐÖÚÓÉ');
end;
And you cannot do the following which is strange:
type Win1250String = type AnsiString(1250);
begin
…..
vrmx.text := Win1250String('áíűüőöúóé ÁÍŰÜŐÖÚÓÉ');
…..
end;