?
Solved

making things easier :)

Posted on 2005-05-09
4
Medium Priority
?
168 Views
Last Modified: 2010-04-05
Well of course that the time im spending here could be used to do all the things manually but this is not the point... hehe.


procedure TForm1.Edit2DblClick(Sender: TObject);
begin
  if Edit2.Text <> '' then
  begin
    listbox1.Items.Add(edit2.text);
    edit2.Text := '';
  end;
end;

I have 30 edits.... all gonna use the same double click procedure... is there anything i can do to just select damn all and use this event on the obj inspector ?

I mean...do i have to select each edit ... paste the code and change the names ? All gonna send the text back to the listbox1 so... is there a easy way to make this procedure universal ?


ty in adv :)
0
Comment
Question by:furmiga
  • 2
4 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 500 total points
ID: 13965334
you can assign one event-procedure to all edits like

procedure TForm1.MyEditDblClick(Sender: TObject);
begin
  if (Sender is TEdit) then
    if TEdit(sender).Text <> '' then
    begin
      listbox1.Items.Add(TEdit(sender).text);
      TEdit(sender).Text := '';
    end;
end;

meikl ;-)
0
 
LVL 7

Author Comment

by:furmiga
ID: 13965369
did i told you that i love you ? haha

sometimes everything sounds so obvious... damn


Tx man u helped me a lot
0
 
LVL 4

Expert Comment

by:StevenB
ID: 13965474
You can select all the edits on the form and assign them all the same double click handler which would be implemented something like this:


procedure TForm1.EditDblClick(Sender: TObject);
begin
  if TEdit(Sender).Text <> '' then
  begin
    listbox1.Items.Add(TEdit(Sender).text);
    TEdit(Sender).Text := '';
  end;
end;
0
 
LVL 4

Expert Comment

by:StevenB
ID: 13965480
Damn, I gotta refresh more often :o)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Loops Section Overview
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

850 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