Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dynamic creation TIWRegion
#1
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 );
Reply
#2
(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.
Reply
#3
remember that also, if/when you will create Frames too
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)