|
<< Click to Display Table of Contents >> Navigation: Forum > Dynamic creation TIWRegion |
07-31-2018, 02:14 PM:
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 );
07-31-2018, 05:56 PM:
(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.
08-01-2018, 03:39 PM:
remember that also, if/when you will create Frames too