Atozed Forums
Dynamic creation TIWRegion - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: Dynamic creation TIWRegion (/thread-534.html)



Dynamic creation TIWRegion - Rassamaha78 - 07-31-2018

I want to create my own analogue ListBox with custom Items. Try use TIWRegion for it:
Code:
//TBetslipItem = class( TIWRegion );

with TBetslipItem.Create( Self ) do
begin
 Parent := rgnBetslip;// rgnBetslip - primary TIWRegion
 Top    := ( rgnBetslip.IWComponentsCount - 1 ) * 120;
 Left   := 0;
 Width  := 120;
 Height := 120;
 Color  := $00303030;
 RenderInvisibleControls := True;
end;
 
  
 When I create (On Button Click) a component the first time, everything works, But if  create more components, i can see only the last one created:

[attachment=37]
[attachment=38]
[attachment=39]

Number in title shows current rgnBetslip.IWComponentsCount;

What could be the problem ?

P.S. If instead of TIWRegion using TIWRectangle then such a problem does not arise, but I can not place any components on TIWRectangle.

The problem is solved. I did not specify the name of the component, for example:
Name := 'BetslipItem' + IntToStr( rgnBetslip.IWComponentsCount );


RE: Dynamic creation TIWRegion - Alexandre Machado - 07-31-2018

(07-31-2018, 02:14 PM)Rassamaha78 Wrote: I want to create my own analogue ListBox with custom Items. Try use TIWRegion for it:
Code:
//TBetslipItem = class( TIWRegion );

with TBetslipItem.Create( Self ) do
begin
 Parent := rgnBetslip;// rgnBetslip - primary TIWRegion
 Top    := ( rgnBetslip.IWComponentsCount - 1 ) * 120;
 Left   := 0;
 Width  := 120;
 Height := 120;
 Color  := $00303030;
 RenderInvisibleControls := True;
end;
 
  
 When I create (On Button Click) a component the first time, everything works, But if  create more components, i can see only the last one created:





Number in title shows current rgnBetslip.IWComponentsCount;

What could be the problem ?

P.S. If instead of TIWRegion using TIWRectangle then such a problem does not arise, but I can not place any components on TIWRectangle.

The problem is solved. I did not specify the name of the component, for example:
Name := 'BetslipItem' + IntToStr( rgnBetslip.IWComponentsCount );

Yes, component name is  mandatory... Thanks for the feedback.


RE: Dynamic creation TIWRegion - EitanArbel - 08-01-2018

remember that also, if/when you will create Frames too