[TSimpleGraph] BUG: random characters in text

Please post bug reports, feature requests, or any question regarding the DELPHI AREA projects here.

[TSimpleGraph] BUG: random characters in text

Postby zizzo81 » March 20th, 2013, 10:41 am

I just compiled the demo application attacched to the download, run it and add a Link line, then go to properties and put in "aaa" as text, as you click Apply or OK the text will appear but will be "aaa" + some weird chinese/japanese characters. Sometime this does not happen, but going in properties again and changing text will do.

Trying to track down the problem I got to the line inside the TGraphLink.DrawText procedure:

Code: Select all
    ExtTextOut(DC, TextCenter.X, TextCenter.Y, TextFlags, nil,
      PChar(TextToShow), Length(TextToShow), nil);


I can't understand what's exactly going on there, code seems to be fine, but does weird things.
Maybe the implicit cast to PChar leaves some bad character into memory without nulling the next character.

This applies to:
TSimpleGraph 2.80
Delphi XE2

Christian
Attachments
WrongLinkCaption.png
WrongLinkCaption.png (98.26 KiB) Viewed 2103 times
User avatar
zizzo81
Member
Member
 
Posts: 3
Joined: October 22nd, 2009, 6:28 am
Location: Italy

Re: [TSimpleGraph] BUG: random characters in text

Postby Kambiz » March 20th, 2013, 6:01 pm

Dear Christian,

Thank you for reporting this bug.

Currently I do not have XE2 but as soon as I get access to it, I'll try to fix the issue.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: [TSimpleGraph] BUG: random characters in text

Postby mathgod » March 23rd, 2013, 8:16 pm

This looks like a unicode anomaly. Find where the string is output to the link label and apply the ansistring function. Re-compile. Test again.
User avatar
mathgod
Junior Member
Junior Member
 
Posts: 35
Joined: December 15th, 2007, 4:36 pm
Location: Middle of New Mexico, USA

Re: [TSimpleGraph] BUG: random characters in text

Postby Kambiz » April 27th, 2013, 2:04 pm

I fixed the bug and it was because of a missing null character terminator that causing 4 extra bytes to the output.

You may want to download the update from the SimpleGraph's page.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm


Return to DELPHI AREA Projects

Who is online

Users browsing this forum: No registered users and 1 guest

cron