trichview.com

trichview.support




SaveComponentToFile


Return to index


Author

Message

James Crosswell

Posted: 02/15/2005 19:43:36


I see in the RVEditDemo a method RichViewEdit1SaveComponentToFile -

which looks like it's hinting at what could be some pretty powerful

functionality for people using RichView to edit stuff other than rich

text documents...


procedure TForm1.RichViewEdit1SaveComponentToFile(Sender: TCustomRichView;

   Path: String; SaveMe: TPersistent; SaveFormat: TRVSaveFormat;

   var OutStr: String);

begin

   case SaveFormat of

    rvsfText:

       begin

         OutStr := '('+SaveMe.ClassName+')';

       end;

    rvsfHTML:

        begin

          if SaveMe is TButton then begin

            OutStr := '<INPUT type="button"

value="'+TButton(SaveMe).Caption+'" '+

                      'onClick="alert(''Just a demo'')">';

            exit;

          end;

          if SaveMe is TEdit then begin

            OutStr := '<INPUT type="text" value="'+TEdit(SaveMe).Text+'">';

            exit;

          end;

        end;

    rvsfRTF:

       begin

         OutStr := '\plain\b ('+SaveMe.ClassName+')';

       end;

    end;

end;


I'm thinking that using this and a bunch of custom controls that new how

to "render" themselves as HTML (a simple combo box for example) you

could turn RichView into a fully fledged HTML Editor... providing the

logic that Opened/Imported  html documents knew to create these custom

controls when opening HTML docs.


Is this perhaps on the horizon/radar as some possible new functionality

for RichView (version 2 maybe)? It would be awesome if you could

load/save HTML documents natively using RichView (and only code events

to override that default functionality - for example if you wanted to

load/save to databases or do special processing for images etc.)


Just an idea in any case.


Best Regards


James Crosswell

Software Engineer

Microforge.net Limited

http://www.microforge.net





Powered by ABC Amber Outlook Express Converter