0

I am using TreeNT Component in my application. I am working on migrating the application to XE2. I have recompiled the component in XE2. When running its not showing the node caption in the window.

Can you give me some tips to manually migrate a third party component to XE2?

jachguate
  • 16,976
  • 3
  • 57
  • 98
Vijesh V.Nair
  • 157
  • 1
  • 18
  • Try using [Virtual TreeView](http://www.lischke-online.de/index.php/controls/virtual-treeview) instead of TreeNT. – kobik Jan 10 '13 at 13:15
  • I can't use that, because the some more user defined components are defined over this control. – Vijesh V.Nair Jan 10 '13 at 13:30

1 Answers1

1

There are a lot of articles about Unicode in Delphi Porting of components is no different from porting applications. Find and read them. Really do.

You'd be hit by PChar -> PAnsiChar/PWideChar ambuiguity, especially if you work in {$T-} mode. Check that your pointers are typed when compiling.

You'd be hit if you did not multiply on Sizeof(char) when allocating buffers or moving raw data my move procedure.

You'd better to search for ambiguous types - char, pchar, string - and remove them, explicitly substituting them by WideChar/PWideChar/UnicodeString or AnsiChar/PAnsiChar/AnsiString depending on context. Thus you would both learn where type transitions may occur and perhaps make compiler so type-checking for you. ShortStirng type (string[255] used bye TreeNT) is non-Unicode by definition. Take care everyplace when you access it.

You'd be hit if you make direct imports from Windows DLLs and specified "A" at the Windows functions name. That can easily result in ANSI function getting unexpected UTF-16 data.

Try to search if someone already did it. For example http://code.google.com/p/keynote-nf/source/browse/trunk/3rd_party/treent/TreeNT.pas - but this ended in 2007, before Unicode in Delphi RTL.

Arioch 'The
  • 15,799
  • 35
  • 62
  • I believe everyone switched to VTW far ago. – Arioch 'The Jan 11 '13 at 06:41
  • There can be two places where it most probably could go off the track. 1st is rendering and 2nd is passing values. 1st you should see if the component renders itself or completely relies on inherited Windows rendering. Search for PAINT word in the sources. You might find WM_PAINT message reference or WMPaint method override or whatever else. If it does not i could even go that far to make new message-method reacting to WM_PAINT and only callign inherited implementation, then turned on "Use Debug DCUs" and traced it into VCL stock TTreeView perhaps up to the point it would either do rendering – Arioch 'The Jan 11 '13 at 06:46
  • or went off to Windows built-inf function. Though tracking that can turn complex sometimes. Another approach would be to - having enabled Debug DCUs - trace deeply some line changing the node's caption. It should go deeper and deeper, perhaps event into VCL sources, to eventually send caption-changing message to Windows widget. It probably would be `TVM_SETITEM` or whatever it was named in VCL and/or TreeNT: [See MSDN](http://msdn.microsoft.com/ru-RU/library/windows/desktop/bb773758.aspx) – Arioch 'The Jan 11 '13 at 06:52
  • and before the message would be sent it would fill data record, and perhaps fail on widestring to ansistring convertion somewhere along this path. When you fix it, please take care to put it out on some open-source file so that someone else would be able to benefit from it and get further, if somedfay needed. – Arioch 'The Jan 11 '13 at 06:54
  • Thanks for the comments. When I tried compile with TNT Delphi unicode componets which giving an error, "A call to an OS function failed." – Vijesh V.Nair Jan 11 '13 at 12:25
  • TNT Unicode Components ? in Delphi XE2 that is already Unicode ? That has no reason to do. And anyway, TNT Unicode Controls have nothign common with TreeNT, why should u even do it ??? – Arioch 'The Jan 11 '13 at 12:35
  • Yea,Thanks, I removed that. I compared my source of TreeNT with TreeNt code from Google code link you provide, that gave the answer. I think Treeview_SetUnicodeFormat(Handle, True); did it majourly, ealier the param was False. Anyhow, Thank you so much. You have a Great weekend. – Vijesh V.Nair Jan 11 '13 at 13:41
  • Glad it helped. Well, if you made it - it would be nice to publish the result somewhere for everyone's benefit. Perhaps you can make your google code page for this. Maybe someone would need it later. thanks and same to You. Perhaps you can revisit your older questions and accept soem answers there too. – Arioch 'The Jan 11 '13 at 13:44
  • Sure, Now I am Testing the result, I will add the changelist on next week. – Vijesh V.Nair Jan 11 '13 at 13:45