Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 02-09-2010, 02:03 PM
Red86 Red86 is offline
Junior Member
 
Join Date: Feb 2010
Posts: 1
Default ListView moving up or down

Hi,

how do you get to move the selected item to move up or down?
Without drag in drop. I'd like to use two buttons for it.

thanks!

edit:
I think I got it:

procedure TFormProductieAgendaSettings.btGebruikerUpClick(Se nder: TObject);
var
iI: Integer;
sTemp: string;
begin
if lstGebruikers.ItemIndex <> -1 then
begin
if not lstGebruikers.ItemIndex = 0 then
begin
iI := lstGebruikers.ItemIndex;
sTemp := lstGebruikers.Items[iI];
lstGebruikers.Items[iI] := lstGebruikers.Items[iI + 1];
lstGebruikers.Items[iI+1] := sTemp;
end
end
end;

procedure TFormProductieAgendaSettings.btGebruikerDownClick(
Sender: TObject);
var
iI: Integer;
sTemp: string;
begin
if lstGebruikers.ItemIndex <> -1 then
begin
if not lstGebruikers.ItemIndex = lstGebruikers.Count -1 then
begin
Ii := lstGebruikers.ItemIndex;
sTemp := lstGebruikers.Items[iI];
lstGebruikers.Items[iI] := lstGebruikers.Items[iI-1];
lstGebruikers.Items[iI-1] := sTemp;
end
end
end;

Last edited by Red86; 02-09-2010 at 02:59 PM.
Reply With Quote
  #2  
Old 02-09-2010, 02:51 PM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 6,113
Default

NB: This only works this way if there's no data assigned!!!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 07:17 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.