[fpc-pascal] Saving user created component structure to LFM file

2009-01-11 Thread Martin Friebe

Hi, I have a problem saving a certain component struicture to an LFM
(lazarus) file and read it back.

since a good amount of code is in FPC, I am not sure which list to go to?

There is classes/writer.inc with has TBinaryObjectWriter. This is where
things go first.
Then, later this gets translated into text. This translation seems to be
stricter in terms of  what can be nested.


Anyway the problem is, that if I want to save a component (that can be
of different class/classes) then I can use WriteComponent. But only if I
am in a Component that is itself written with WriteComponent.

In the final LFM it seems a Component can only be nested in an other
component. It does not seem to be possible to put it in:
- Not in a subcomponent (because a subcomponent does not write it's
class, but just the properties that are visible for the class given by
the property
property Foo: TPanel read .. write ...
 writes
Foo.Name = 'abc'
Foo.Top = 1
...
- Not in a TCollection, or at least I havent managed. Also again a
TCollection is restricted to one classs for all Items
- Not Using DefineProperties
 All propwerties with define property are of the kind
 Name = Value
 I can add a list, but even inside the list I can not write a component


What I want to archive is theFollowing. I have

TMainComponent = class (foo)
  property Options : TPersitentBar read  x write x;
end

If It has to be it can be a TComponent, with SubComponent in
TComponentStyle.
Problem 1)   Options is always created in the constructor, it can not be
stored as a nested Component in the LFM. If it was, it would exist twice
(once created in the constructor, and once loaded from the lfm)

TPersitentBar should have a list of components, variable number, and
different subclasses (could inherit from TPersistent, only Component if
it makes it easier)

How can I get this list saved into the lfm? Each item has a diff class,
and diff properties, so they must saved via WriteComponent. (Which does
not work for DefineProerties)

And of course a default list of items is created in the constructor, so
I need to detect if they are loaded, and remove the defaults.

Any Idea?

Example of the final structure (if only it was valid)

object MainComp1 : TMainComponent
 Options.AllowFoo = 1
 Options.AllowABC = 2
 object Options.SubOptionsForCars : TCarOptions
 MAxCar = 4
 end
 object Options.SubOptionsForTrains : TTrainOptions
 MAxTrain = 1
 end
end


Best Regards
Martin





___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Suggestions for fpspreadsheet

2009-01-11 Thread Graeme Geldenhuys
On 1/10/09, Felipe Monteiro de Carvalho
 wrote:
>
>  I am not saying I will implement any of this in a short time, just
>  asking for suggestions =)

OpenDocument read/write support -- seeing that that is the preferred
format these days and adheres to open standards.


Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Suggestions for fpspreadsheet

2009-01-11 Thread Boris Samorodov
Hello List,


On Sat, 10 Jan 2009 17:30:31 +0100 Felipe Monteiro de Carvalho wrote:

> I got some time and I decided to improve fpspreadsheet:
> http://wiki.lazarus.freepascal.org/FPSpreadsheet

> I wrote a OLE document generator, so now it is possible to generate
> Excel 5 spreasheets in any platforms (actually some lines of code are
> missing for big endian systems). And it supports numbers, text and
> formulas, as well as multiple worksheets in the same file. Excel 2
> support is also complete.

Very interesting. Thanks for your work!

> I have some more time, but I am not entirely sure what would really
> add value to the library, so I thougth I would ask possible users what
> they really need (I already have all the functionality I need). Some
> ideas I had are:

> * Add support to also read Excel 5 files

I'd vote for this one twice if possible. ;-)
As for the others they are interesting but not very important for me.

> * Add write support to other formats
> * More advanced formulas
> * Make charts (maybe too hard?)

> I went for Excel 5 because it's supported by nearly all spreadsheet
> software out there and has lot's of features.

> I am not saying I will implement any of this in a short time, just
> asking for suggestions =)


WBR
-- 
bsam
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal