On Friday 08 April 2016 20:12:03 Krzysztof wrote:
> Hi Martin,
>
> I have created own Tlayouter descendant which have other controls as
> childs (TButton and also Tlayouter). I got weird behavior by setting
> properties in costructor. Finally found out that I placed my new
> component on form before changes in its constructor so they were saved
> in mfm and on runtime they mixed with mfm and changes in costructor.
> After delete component and drop it again, everything is working fine.
> So my request is, could you change current Tlayouter component to
> TCustomlayouter, change published properties to public and create new
> class Tlayouter = class(TCustomlayouter) with published properties?
> Then I can inherit from TCustomlayouter and publish only what I want
> because I guess that only published properties are saved into mfm,
> right? I think that you just forgot create TCustomlayouter because I
> see TCustomButton etc everywhere.
>
Done, git master 9a350f3b2b0ca7bc24808cb8e5bd2c32b576d203.

Instead of writing a new combined widget component it is also possible to 
store a component selection including the property settings from formdesigner 
in 'View'-'Component Store'. 
Stored components can be inserted in forms by selecting the wanted item in 
the 'Sel' column of 'Component Store' like clicking into the 'Component 
Palette' window.
Another option is to design the component based 
on 'File'-'New'-'Form'-'Subform' and to register the form class.

> Also have other questions:
> 1. Why can't override Create constructor? I have this:
>
>   TMCMenu = class(tlayouter)
>   private
>     FMenuLayout: tlayouter;
>   public
>     constructor create(aowner: tcomponent); override;
>
> Create in tlayouter is public and virtual. This is a puzzler. I need
> to use AfterConstruction virtual method
>
If you get a compiler error you probably forgot to add "mclasses"
after "classes" in "uses". MSEgui uses an extended TComponent class. It was 
necessary because the FPC team did not want to move fields from private to 
protected and because of new optimisations which prevents the use of cracker 
classes.

> 2. Why setting child component: FMenuLayout.SetSubComponent(True) does
> nothing? I still can select this component (and all other childs) at
> design time. I'm setting it there:
>
SetSubComponent influences streaming. Please disable ws_iswidget in 
fwidgetstate in order to hide the widget from MSEide editing.

Another option is to use the overloaded TWidget.Create():
"
   constructor create(const aowner: tcomponent;
                      const aparentwidget: twidget;
                      const aiswidget: boolean = true); overload;
"
> procedure TMCMenu.afterconstruction;
> begin
>   inherited afterconstruction;
>
>   FMenuLayout := tlayouter.create(Self);

   FMenuLayout := tlayouter.create(Self,Self,false); <<<<<<<<<-----

Martin

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial! http://pubads.g.doubleclick.net/
gampad/clk?id=1444514301&iu=/ca-pub-7940484522588532
_______________________________________________
mseide-msegui-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to