- This topic has 2 replies, 2 voices, and was last updated 2020-11-24 at 3:13 am by .
Viewing 2 reply threads
Viewing 2 reply threads
- You must be logged in to reply to this topic.
Home › Forums › Konopka Signature VCL Controls (formerly Raize Components) › TRzListBox Add Item to Group
Hi
I have a TRzListBox setup with 2 headings: ‘Players’ and ‘Reserves’. During the application a User can add a new Player or Reserve.
How do I add this new player to the ‘Players’ section? When I simply clList.Add( cNewName ) it goes to the bottom of the list.
Hi Barry,
You can use the AddItemToGroup method. For example, the following code adds a couple groups and items to the list. Then in the button click event handler, a new player is added to the first group. Changing the first parameter to a 1 will add Ian to the Reserves group.
Ray
procedure TForm8.FormCreate(Sender: TObject);
begin
RzListBox1.ShowGroups := True;
RzListBox1.AddGroup( 'Players' );
RzListBox1.Add( 'Anthony Rizzo' );
RzListBox1.Add( 'Kris Bryant' );
RzListBox1.Add( 'Javier Baez' );
RzListBox1.AddGroup( 'Reserves' );
RzListBox1.Add( 'Albert Almora Jr.' );
end;
procedure TForm8.RzButton1Click(Sender: TObject);
begin
RzListBox1.AddItemToGroup( 0, 'Ian Happ' );
end;
Ray,
Many thanks, as ever. I’m building up a list of ‘simple’ examples of how to use your controls ‘properly’, so one day I won’t need to ask you 🙂
We use cookies to improve your experience on our site. By using our site, you consent to cookies.
Manage your cookie preferences below:
Essential cookies enable basic functions and are necessary for the proper function of the website.
These cookies are needed for adding comments on this website.
These cookies are used for managing login functionality on this website.
Stripe is a payment processing platform that enables businesses to accept online payments securely and efficiently.
Service URL: stripe.com (opens in a new window)