Solved

ListBox Question For The Experts

Posted on 1998-12-07
10
164 Views
Last Modified: 2010-04-04
I have tvo listbox when i click any item in the listbox1 then i will the listbox2 item moves to the itemindex of listbox1 ( the blue arround it )and one question ( what is the "values" and "Name" properties of this component? how can i use them..Thanks.....
0
Comment
Question by:emiltor
10 Comments
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 50 total points
ID: 1349758
The name property is the componet name (eg: ListBox1). There is not property "values" in the TlistBox component, I assume you mean "items".

Items is the list of entries in the list box. To add some items you can do this:

listBox1.items.add('Item 1');
listBox1.items.add('Item 2');
listBox1.items.add('Item 3');

Cheers,

Raymond.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1349759
hi emiltor,

first:

procedure TForm1.ListBox1Click(Sender: TObject);
begin
  Listbox2.ItemIndex := listbox1.ItemIndex;
end;

second

  There is no value property
  Name is the property where you can name the component

meikl

0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1349760
hi emiltor,

the items in listbox contains the property values

you can use this, when the entries in the listbox in the following format

xy=z

with

with listbox1.items.values['xy'] you can retrieve the z

sample

  edit1.text :=  listbox1.items.values['xy'];

meikl
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 10

Expert Comment

by:viktornet
ID: 1349761
YOu can use this..

OnClick()

ListBox2.ItemIndex := ListBox1.ItemIndex;

or if the same string is in a different line then you can use something like this...

ListBox2.ItemIndex := ListBox2.IndexOf(ListBox1.Items.Strings[ListBox1.ItemIndex]);

Hope this helps...

Cheers,
Viktor
0
 

Author Comment

by:emiltor
ID: 1349762
Adjusted points to 50
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1349763
hi emiltor,

are you sure that your accepted answer reflects your question?

meikl
0
 

Author Comment

by:emiltor
ID: 1349764
Yes..... Victornet have it
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1349765
Oh .. really?

i think rwilson have it

meikl
0
 

Author Comment

by:emiltor
ID: 1349766
RWilson have the answer for "Values" question And Name but not the other question

Like move the blue arround the text in listbox2 on listbox1.itemindex
Viktornet have the answer for that...


0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1349767
as you mean
its your thread

meikl

0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

776 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