Solved

Editing Listbox on runtime

Posted on 2004-03-26
4
265 Views
Last Modified: 2010-04-05
Hey,

Can someone tell me how I can edit my listbox on runtime to when I select a item in the listbox and then click and button it will add "Locked" after the string in the listbox.

Cheers,

Computer Programer
0
Comment
Question by:computerprogramer
  • 2
  • 2
4 Comments
 
LVL 17

Accepted Solution

by:
mokule earned 40 total points
ID: 10685217
procedure TForm1.Button2Click(Sender: TObject);
begin
ListBox2.Items[ListBox2.ItemIndex] := ListBox2.Items[ListBox2.ItemIndex]+' Locked';
end;
0
 
LVL 17

Expert Comment

by:mokule
ID: 10685234
or better with check

procedure TForm1.Button2Click(Sender: TObject);
begin
if (ListBox2.Items.Count > 0) and (ListBox2.ItemIndex >= 0) then
  ListBox2.Items[ListBox2.ItemIndex] := ListBox2.Items[ListBox2.ItemIndex]+' Locked';
end;
0
 
LVL 5

Expert Comment

by:snehanshu
ID: 10685235
Is this what you are looking for?
(Add text 'Locked' to current item of list box when a button is clicked)

procedure TForm1.Button1Click(Sender: TObject);
begin
  If ListBox1.ItemIndex >= 0 then
  Begin
    ListBox1.Items[ListBox1.ItemIndex] := ListBox1.Items[ListBox1.ItemIndex] + 'Locked';
  End;
end;

...Shu
0
 
LVL 5

Expert Comment

by:snehanshu
ID: 10685282
3 minutes: too late.
:-)
...Shu
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi component that can load a DLL in design time? 8 64
Communication Between RC4 Delphi <-> PHP 3 114
creating threads in delphi 1 104
Performance of SQL statement 37 111
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question