The easy bit sometimes gets aekward.
With Gambas it's:
ListBox7[0].Text - and you have a string of the first Item of the listbox.
Tried a lot, but didn't find something working on my lazarus project.
Thanks for helping out without yawning.... but it gets a bit more wiered.
The basic idea is to transfer all items from ListBox1 to ListBox6.
Clear ListBox1 and then transfer all items of listbox6 back to
ListBox1 - but! in reverse order.
So result should be that previous first Item of ListBox1 is now
last item in ListBox1.
Trying all afternoon and if I had an Uzzi, I'd shoot the computer
if that helped....
So a txt file with 150 numbers, 1 number each line, is nicely loaded
into ListBox1, as needed for a lot of operations which all are working
OK.
OpenDialog1.Filter:='txt-Dateien|*.txt';
if OpenDialog1.Execute then
ListBox1.Items.LoadFromFile(OpenDialog1.Filename);
for i:=ListBox1.Items.Count - 1 downto 0 do begin
ListBox1.Items[i] := Trim(ListBox1.Items[i]);
if not TryStrToInt(ListBox1.Items[i], iTest) then
ListBox1.Items.Delete(i);
end; //its designed to eliminate unwanted text
The "First To Last" button has the following code:
procedure TForm1.Button96Click(Sender: TObject);
var
i: Integer;
begin
for i := ListBox1.Count -1 downto 0 do begin;
ListBox1.ItemIndex := ListBox1.Items.Count-1;
ListBox6.Items.Add((ListBox1.Items.Strings[Pred(ListBox1.Count -1)]));
ListBox1.Items.Delete(ListBox1.ItemIndex);
end;
ListBox6.ItemIndex := ListBox6.Items.Count-1;
ListBox1.ItemIndex := ListBox1.Items.Count-1;
ListBox1.Clear;
end;
Although only haf of the task -
That does not work and LazTracer comes with some complaint.
If I set the downto to 1, instead of 0, hi, all goes well.
(I allways check that all the end; statements are wehre they should be...)
As said before, now all items of LixtBox 6 need to get back into
ListBox1 in revers order....
Maybe the operation can be done with using ListBox1 only.