Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Основная";
Текущий архив: 2004.01.23;
Скачать: [xml.tar.bz2];

Вниз

Как получить номер строки и столбца TStringGrid, на котором...   Найти похожие ветки 

 
Шурик Ш   (2004-01-12 16:20) [0]

Как получить номер строки и столбца TStringGrid, на котором нажата правая кнопка мыши и выбран пункт контекстного меню?


 
pasha_golub   (2004-01-12 16:23) [1]

OnMouseDown+MouseToCell+F1


 
GLFox   (2004-01-12 16:25) [2]

Запоминай координаты - GetCursorPos() перед показом менюшки, по ним и найдешь свой Cell.


 
Anatoly Podgoretsky   (2004-01-12 16:28) [3]

Row/Col


 
Serge   (2004-01-12 16:29) [4]

Returns the column and row of the cell at the position with screen coordinates (X,Y).

procedure MouseToCell(X, Y: Integer; var ACol, ARow: Longint);

Description

Call MouseToCell to convert from grid-relative screen coordinates to row and column indexes. The X and Y parameters are the screen coordinates of the point to be converted. MouseToCell returns the ACol parameter as the number of the column over the point (X,Y), and the ARow parameter as the number of the row.

Usually the MouseToCell method is used in a mouse event handler, which supplies the mouse coordinates as the X and Y parameters of the method call.


 
Шурик Ш   (2004-01-12 16:43) [5]

To GLFox (12.01.04 16:25) [2]
Дело в том что GetCursorPos() возвращает абсолютные координаты, а MouseToCell нужны относительные. А как получить их?


 
Anatoly Podgoretsky   (2004-01-12 16:46) [6]

Так тебе не номер строки/колонки а координаты мыши, тогда ScreenToClient


 
Шурик Ш   (2004-01-12 16:49) [7]

Мне нужны номер строки/колонки, но конструкция:
procedure TDataForm.DataSGPopupMenuPopup(Sender: TObject);
begin
GetCursorPos(MCoord);
end;

procedure TDataForm.DeleteItemClick(Sender: TObject);
var
Col, Row: Longint;
i,j: Integer;
begin
DataStringGrid.MouseToCell(MCoord.X, MCoord.Y, Col, Row);
...
end;


присваивает Col = -1 и Row = -1.


 
Юрий Зотов   (2004-01-12 17:07) [8]

Сказали же - ScreenToClient.


 
Anatoly Podgoretsky   (2004-01-12 17:18) [9]

А про прямое получение координат строки и колонки в [3]



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

Форум: "Основная";
Текущий архив: 2004.01.23;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.46 MB
Время: 0.006 c
14-72887
GrayFace
2004-01-03 17:06
2004.01.23
Тупость правил форума


9-72619
CERGEY
2003-07-05 09:16
2004.01.23
Трудно писать RPG одному...


14-72870
EvgeniusII
2003-12-30 18:20
2004.01.23
Можно ли на Delphi


7-72953
ravlyk
2003-11-07 09:46
2004.01.23
интеграция VBA


14-72942
Всеволод Соловьёв
2004-01-01 00:12
2004.01.23
З новим роком москалів!





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский