trichview.com

trichview.support




Re: RichviewXML and Control


Return to index


Author

Message

Udo Weik

Posted: 04/13/2005 15:12:56


Hello Khang,


> I have document with some controls on it then I save this documents to

> XML file with RichviewXML. I got an access violation error when I try to

> reload the saved file.


Did you register the class?


> Do you have any working example of RichViewXML with Controls (i.e.

> Tedit) codes.


Only in C++:


In FormCreate:


   RegisterClass( __classid( TButton ) ) ;


Adding one TButton:


   TButton* pButton ;


   rveAPP_->Clear() ;

   rveAPP_->AddNL( "Example of adding controls", 1, 1 ) ;


   rveAPP_->AddBreakEx( 3, rvbsLine, clRed ) ;


   // Adding TButton


   pButton = new TButton( (TComponent*)NULL );

   pButton->Caption = "Khang";

   pButton->Width   = 20;

   pButton->Height  = 20;

   rveAPP_->AddControlEx( "", pButton, -1, rvvaMiddle ) ;


SaveToFile:


   AnsiString sFilePath ;


   sFilePath = ExtractFilePath( Application->ExeName ) + "XML"  ;


   rvxmlAPP_->BaseFilePath = sFilePath + "\\Content" ;

   rvxmlAPP_->SaveToFile( sFilePath + "\\Test1.XML" ) ;


LoadToFile:


   AnsiString sFilePath ;


   sFilePath = ExtractFilePath( Application->ExeName ) + "XML"  ;


   rvxmlAPP_->BaseFilePath = sFilePath + "\\Content" ;

   rvxmlAPP_->LoadFromFile( sFilePath + "\\Test1.XML" ) ;



Hope that helps.



Greetings

Udo





Powered by ABC Amber Outlook Express Converter