Вниз
Скачать: 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 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.01 c
1-34408
zloy_dima
2003-04-30 11:53
2003.05.12
Динамический массив


1-34402
anton2v
2003-04-30 11:50
2003.05.12
Размер программы на диске


8-34513
antonn
2003-02-01 09:54
2003.05.12
dsound.dcu not found


3-34360
Ruslan.
2003-04-22 14:15
2003.05.12
VIEW


8-34516
TALLA
2003-01-25 02:56
2003.05.12
Как изменить скорость(+/-) wav файла (изменив его)?




   Наверх