Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2003.05.12;
Скачать: CL | DM;

Вниз

TListBox - перемещение элементов   Найти похожие ветки 

 
Матка   (2003-04-28 02:33) [0]

Бррррррррррр!
Как в TListBox перемещать элементы с помощью клавиш Alt+Up и Alt+Down?


 
Мор   (2003-04-28 03:00) [1]

Удалено модератором
Примечание: Задай вопрос в своей ветке


 
Chlavik ©   (2003-04-28 03:04) [2]

OnKeyPress и всё будет благополучно.....


 
Chlavik ©   (2003-04-28 03:05) [3]

OnKeyDown и всё будет благополучно.....


 
Матка   (2003-04-29 02:13) [4]

Бррррррррррр!

2 Chlavik
А я прям такой тупой!

2 All
Пробовал так:

if ssAlt in Shift then
begin
if Key = VK_UP then ListBox.Items.Move(ListBox.ItemIndex, ListBox.ItemIndex - 1);
if Key = VK_DOWN then ListBox.Items.Move(ListBox.ItemIndex, ListBox.ItemIndex + 1);
end;


Работает, но не так, как надо. Проверьте сами...


 
Separator ©   (2003-04-29 06:53) [5]

procedure TForm1.ListBox1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
var
NewIndex: integer;

begin
if (ssAlt in Shift) and ((Key = VK_UP) or (Key = VK_DOWN)) then
with ListBox1, ListBox1.Items do
if ItemIndex <> -1 then begin
NewIndex:= ItemIndex;
if Key = VK_UP then NewIndex:= ItemIndex - 1;
if Key = VK_DOWN then NewIndex:= ItemIndex + 1;
if NewIndex = -1 then NewIndex:= Count - 1 else
if NewIndex = Count then NewIndex:= 0;
Move(ItemIndex, NewIndex);
ItemIndex:= NewIndex
end
end;


Все работает лучше некуда



Страницы: 1 вся ветка

Текущий архив: 2003.05.12;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.013 c
3-34355
saha
2003-04-22 12:30
2003.05.12
Как побороть AdoDATASet?


14-34556
Style
2003-04-23 10:16
2003.05.12
Конкурс на самый извратный Hello World :)


14-34581
race1
2003-04-23 18:31
2003.05.12
Monitor


8-34517
Blastoderm
2003-01-22 14:45
2003.05.12
TAnimate->OnClick ?


14-34561
Style
2003-04-23 18:39
2003.05.12
Delphi Challenge! Пришло письмо с просьбой перенести 1-й тур