Solved

TEdit Text Replacement function

Posted on 2009-03-29
2
356 Views
Last Modified: 2012-05-06
Hey all,

Hope I can explain this somewhat good.

I have 12 TEdit placed on my form, all filled with different names in the text field. Also, I have a Listbox1 filled with all the names + 10 to 15 other names.

When the user clicks on one of the names in the Listbox1, the name gets chosen and the user gets to choose on which TEdit (out of the 12) to place the name.

No problem so far; however, if the name chosen already exists on another TEdit then those two TEdit should be swapped with eachother.

Example:

Edit1.Text := 'Johnson';
Edit2.Text := 'Anderson';
Edit3.Text := 'Swanson';

Listbox1 contains the names Peterson, Swanson, Anderson, Johnson, Perry.

Let's say the user picks 'Swanson' from the Listbox1 and then clicks on Edit1 (Edit1.Text := Listbox1.Items[Listbox1.ItemIndex]) - then, as Swanson already exists on Edit3, Johnson and Swanson should just switch place from Edit3<->Edit1.

And the new result would be:

Edit1.Text := 'Swanson';
Edit2.Text := 'Anderson';
Edit3.Text := 'Johnson';

What would be the most efficient way to achieve this, with as little code as possible? Seeing as this code would have to be on every Edit*.click; ?

Hope you understood me somewhat, otherwise I'll be happy to give it another try :)
0
Comment
Question by:MerlaP83
2 Comments
 
LVL 13

Accepted Solution

by:
ThievingSix earned 250 total points
ID: 24015311
https://filedb.experts-exchange.com/incoming/ee-stuff/7588-Q_24275851.zip

This should work for you. Kind of a basic example but it works.
0
 

Author Closing Comment

by:MerlaP83
ID: 31564118
Basic, but worked like I expected and wanted to.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi TcxGrid group footer summary 3 206
Delphi : could not find program, '...exe' 2 145
Intraweb download file link ? 1 107
TEMBEDDEDWB how can i change its user agent ? 8 45
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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
A short film showing how OnPage and Connectwise integration works.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

919 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now