trichview.com

trichview.support




Why cconvert to PChar?


Return to index


Author

Message

Martin Holmes

Posted: 10/29/2003 16:35:46


Hi there,


This may be a silly question -- forgive my ignorance if it is!


I've been looking at some of the demo Delphi code, and I see examples

where you're using a PChar where I wouldn't expect it. Here's one from

the Save HTML example:


procedure TForm1.RichView1RVMouseMove(Sender: TObject; id: Integer);

var RVData: TCustomRVFormattedData;

     ItemNo: Integer;

begin

   if id=-1 then

     StatusBar1.SimpleText := ''

   else begin

     RichView1.GetJumpPointLocation(id, RVData, ItemNo);

     StatusBar1.SimpleText := PChar(RVData.GetItemTag(ItemNo));

   end;

end;


As far as I can see, TStatusBar.SimpleText is a Delphi string;

GetItemTag returns a pointer to a string, so I would have thought you

could assign it directly, or just dereference the pointer.


Cheers,

Martin





Powered by ABC Amber Outlook Express Converter