Вниз
Скачать: 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.46 MB
Время: 0.011 c
14-34608
Dms
2003-04-23 10:05
2003.05.12
технология создания Update к своим программам


1-34430
Oleg__
2003-04-28 17:07
2003.05.12
WordApplication


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


1-34395
Tapchyk
2003-04-29 01:29
2003.05.12
Реестр


6-34526
elf_123
2003-03-16 15:48
2003.05.12
Глупенький маленький вопросик(Client/Server Socket)




   Наверх