Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > Низкоуровневое программирование > Win Api
Регистрация

Восстановить пароль

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 19.10.2009, 18:44   #1
TwiX
Участник клуба
 
Аватар для TwiX
 
Регистрация: 28.07.2009
Сообщений: 1,510
По умолчанию Можно ли как-нибудь с помощью sendmessage послать дабл-клик на элемент listview'a?

Можно ли как-нибудь с помощью sendmessage послать дабл-клик на элемент listview'a?

Добавлено:
И установить первый видимый элемент по индексу? А то у listbox'a есть lv_settopindex, а тут не нашёл...
TwiX вне форума Ответить с цитированием
Старый 19.10.2009, 21:37   #2
Пепел Феникса
Старожил
 
Аватар для Пепел Феникса
 
Регистрация: 28.01.2009
Сообщений: 21,000
По умолчанию

1)через это узнаем где нужный нам элемент:
Цитата:
An application sends an LB_GETITEMRECT message to retrieve the dimensions of the rectangle that bounds a list box item as it is currently displayed in the list box.

LB_GETITEMRECT
wParam = (WPARAM) index; // item index
lParam = (LPARAM) (RECT FAR*) lprc; // address of rectangle


Parameters

index

Value of wParam. Specifies the zero-based index of the item.
Windows 95: The wParam parameter is limited to 16-bit values. This means list boxes cannot contain more than 32,767 items. Although the number of items is restricted, the total size in bytes of the items in a listbox is limited only by available memory.

lprc

Value of lParam. Points to a RECT structure that will receive the client coordinates for the item in the list box.



Return Values

If an error occurs, the return value is LB_ERR.
и потом:
Цитата:
The WM_LBUTTONDBLCLK message is posted when the user double-clicks the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.

WM_LBUTTONDBLCLK
fwKeys = wParam; // key flags
xPos = LOWORD(lParam); // horizontal position of cursor
yPos = HIWORD(lParam); // vertical position of cursor


Parameters

fwKeys

Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values:

Value Description
MK_CONTROL Set if the CTRL key is down.
MK_LBUTTON Set if the left mouse button is down.
MK_MBUTTON Set if the middle mouse button is down.
MK_RBUTTON Set if the right mouse button is down.
MK_SHIFT Set if the SHIFT key is down.


xPos

Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

yPos

Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.



Return Values

If an application processes this message, it should return zero.

Remarks

Only windows that have the CS_DBLCLKS style can receive WM_LBUTTONDBLCLK messages, which Windows generates whenever the user presses, releases, and again presses the left mouse button within the system's double-click time limit. Double-clicking the left mouse button actually generates four messages: WM_LBUTTONDOWN, WM_LBUTTONUP, WM_LBUTTONDBLCLK, and WM_LBUTTONUP again.
2)
Цитата:
An application sends an LB_SETTOPINDEX message to ensure that a particular item in a list box is visible.

LB_SETTOPINDEX
wParam = (WPARAM) index; // item index
lParam = 0; // not used; must be zero


Parameters

index

Value of wParam. Specifies the zero-based index of the item in the list box.
Windows 95: The wParam parameter is limited to 16-bit values. This means list boxes cannot contain more than 32,767 items. Although the number of items is restricted, the total size in bytes of the items in a listbox is limited only by available memory.



Return Values

If an error occurs, the return value is LB_ERR.

Remarks

The system scrolls the list box contents so that either the specified item appears at the top of the list box or the maximum scroll range has been reached.
Хорошо поставленный вопрос это уже половина ответа. | Каков вопрос, таков ответ.
Программа делает то что написал программист, а не то что он хотел.
Функции/утилиты ждут в параметрах то что им надо, а не то что вы хотите.
Пепел Феникса вне форума Ответить с цитированием
Старый 20.10.2009, 13:13   #3
TwiX
Участник клуба
 
Аватар для TwiX
 
Регистрация: 28.07.2009
Сообщений: 1,510
По умолчанию

1) Тут я так и делал, но дело в том, что если итем не виден на экране, то ему не пошлётся дабл-клик. Я думал, может у лист-вьева есть какая-нибудь специальная функция...

2) Говорю же, LB_SETTOPINDEX - это для ListBox'a, что не работает на лист-вьеве =\
TwiX вне форума Ответить с цитированием
Старый 20.10.2009, 13:31   #4
Пепел Феникса
Старожил
 
Аватар для Пепел Феникса
 
Регистрация: 28.01.2009
Сообщений: 21,000
По умолчанию

1)нельзя кликнуть по итему если его нет на экране...
2)извиняюсь перепутал..
вот что нашел
Цитата:
The LVM_ENSUREVISIBLE message ensures that a list view item is entirely or at least partially visible, scrolling the list view control if necessary. You can send this message explicitly or by using the ListView_EnsureVisible macro.

LVM_ENSUREVISIBLE
wParam = (WPARAM) (int) i;
lParam = (LPARAM) (BOOL) fPartialOk;


Parameters

i

Index of the list view item.

fPartialOK

Value specifying whether the item must be entirely visible. If this parameter is TRUE, no scrolling occurs if the item is at least partially visible.



Return Values

Returns TRUE if successful or FALSE otherwise.
Хорошо поставленный вопрос это уже половина ответа. | Каков вопрос, таков ответ.
Программа делает то что написал программист, а не то что он хотел.
Функции/утилиты ждут в параметрах то что им надо, а не то что вы хотите.
Пепел Феникса вне форума Ответить с цитированием
Старый 20.10.2009, 18:33   #5
TwiX
Участник клуба
 
Аватар для TwiX
 
Регистрация: 28.07.2009
Сообщений: 1,510
По умолчанию

Спасибо за LVM_ENSUREVISIBLE
Очень полезная штука оказалась =)
А вот getItemRect чего-то тупит. В рект загоняет только left =\

Только плюсик не могу уже раз третий поставить =)
TwiX вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц



Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
Можно ли как нибудь Лицензионную XP поставить на несколько компов? vicvtor Windows 22 16.09.2014 16:46
Можно ли как-нибудь сохранить текущее оформление Windows? Познающий Софт 2 04.06.2009 21:41
А можно как нибудь задействовать JAVA SCRIPT в делфи eldar Работа с сетью в Delphi 0 05.09.2008 20:57
как вы думаете можно с помощью delphi написать online игру ну к примеру как muonline 0pex Свободное общение 9 28.06.2007 14:20
Можно ли как-нибудь изменить реакцию всплывающих менюшек на кнопки? Major Gray Общие вопросы Delphi 0 15.04.2007 01:23