Streaming custom data when saving and loading forms...

  • Hi, I am using WPForms2 and I need the following situation to work:

    I have a custom TWPFCustomGraphicObject class with a button on it. This class also contains a few in-memory database tables (TdxMemData from DevExpress) that are empty by default. The purpose is that a user clicks on the button and a data-entry form will pop up where she can enter all kinds of information. When the form is closed, this data is then displayed on the form.

    Well, it all works reasonable well but I need a way to save and load these forms to file AFTER she has entered data. This data needs to be stored with the form. But I can'tt discover where I can hook into the save/load mechanism of WPForms to include my stream of data into the whole stream of data.

    Of course an option would be to do the saving in my own code, using my own save/load actions but I don't like that option right now. I feel that would be like defining my own file format while WPForms already has a good file format.

    • Offizieller Beitrag

    Hi,

    The property data of Custom objects is saved if the property is published. For blob data I suggest to use the LoadStreamData procedure.

    About your own fileformat:

    There is a demo to save the form as XML file.
    XML is a rather slow and a big format (WPF is neither but rather kryptic) but it is readable and easy to maintain.

    Julian Ziersch

  • I also seem to have problems when I start the 'Create Report' action, because this action seems to close the graphic control, then creates two copies of it again and finally deletes one of these copies again. Seems a bit complex in my opinion, but worse... The data in my custom property (assigned to FProperties) just are lost...

    I must say that it's a very complex task to add even a single custom graphic.

  • I have redesigned my project a bit. The multiple navigators on the form looked great and promising but I had too many technical problems getting it all contained within a Graphic component that needed to hide itself while printing.

    As an alternative, I have chosen to just add the navigator to a toolbar, combined with buttons to add and delete tables to the form and also a dropdown control to select the table that I want the navigator to control. As a result, I don't need to create a custom graphic anymore.

    To control this all, I have a special list component that contains a special class that links together a TDataset with a TDataSource, a TWPFDataSource, a TWPFObjectInspectorBand and finally a WPFObjectInspector. By using this control I can simply add new tables and automatically add a band to the inspector and make sure the form can addess the dataset fields. Also allows the table to deleted again, cleaning everything up again.

    But now I need this control to be saved and loaded together with the form. Basically just so it saves and loads all information about the tables that have been selected. The control can stream itself to any stream but am now just wondering about the best method to save and load it together with the form.
    The FormDesigner class does have events that are called after loading and before saving but these don't allow me to append the data to the form data. It would have been nice if there was an event that gets called to allow the user to load and save some custom data to the file.

    I now have to search for a nicer, alternative solution.