Subject:
|
Re: I need help on Delphi so I can finnish my program
|
Newsgroups:
|
lugnet.cad.dev
|
Date:
|
Wed, 18 Sep 2002 21:42:37 GMT
|
Viewed:
|
481 times
|
| |
 | |
In lugnet.cad.dev, Eduardo Vazquez Harte writes:
> I need to know how can I pass a selected Listbox item to a lets say 4 edits.
> Example user clicks on a item an then delphi passes the 4 words in the
> current item to 4 edits a word in each edit.
>
> Can someone help me plase.
>
> I hope is not with Extractlist funtion
If you don't want to use the ExtractStrings function then do this:
StringList := TStringList.Create;
i := 1;
String1 := '';
String2 := ListBox.Items[ListBox.ItemIndex];
while i <= Length(String2) do
begin
if String2[i] <> ' ' then
begin
String1 := String1 + String2[i];
inc(i);
end
else
begin
StringList.Add(String1);
String1 := '';
inc(i);
end;
end;
Now the individual words are in the StringList with the Nth word of String2
being StringList[N-1]. You could also use an array of strings if you don't
want to use TStringList (i.e. StringList: array of string), in this case
instead if the Add method use:
SetLength(StringList,1);
StringList[0] := '';
i := 1;
j := 0;
String2 := ListBox.Items[ListBox.ItemIndex];
while i <= Length(String2) do
begin
if String2[i] <> ' ' then
begin
StringList[j] := StringList[j] + String2[i];
inc(i);
end
else
begin
SetLength(StringList, Length(StringList+1));
inc(j);
StringList[j] := '';
inc(i);
end;
end;
|
|
Message is in Reply To:
 | | Re: I need help on Delphi so I can finnish my program
|
| I need to know how can I pass a selected Listbox item to a lets say 4 edits. Example user clicks on a item an then delphi passes the 4 words in the current item to 4 edits a word in each edit. Can someone help me plase. I hope is not with (...) (23 years ago, 18-Sep-02, to lugnet.cad.dev)
|
10 Messages in This Thread:         
    
    
   
   
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|