Jump to content

Как определить координаты ячейки в DBGrid


roa36

Recommended Posts

Подскажите, можно ли определить координаты ячейки в UniDBGrid.

Мне необходимо при нажатии клавиши мыши на ячейку вывести некоторую форму в левом верхнем углу выделенной ячейки.

Link to comment
Share on other sites

On 12/15/2019 at 1:27 PM, roa36 said:

Можно просто ответить на вопрос! Если нет ответа - лучше ничего не писать!!!

Кричать не обязательно, тут такие правила. Если товарищ не использует триальную версию, то спрашивается, откуда он взял не триальную.

Далее

  property CurrRow;
   property CurrCol;

  • Like 1
Link to comment
Share on other sites

Stas, спасибо за попытку, но как мне с помощью ( property CurrRow; property CurrCol) показать форму с координатами Top, Left  левого верхнего угла выделенной ячейки.

Link to comment
Share on other sites

Кое как нашел...

в UniDBGrid > ExtEvents > Ext.grid.Panel

событие (функция) cellmousedown

function cellmousedown(sender, td, cellIndex, record, tr, rowIndex, e, eOpts)

{     var c = Ext.get(td).getXY();     ajaxRequest(this, 'CellXY', ['x='+c[0], 'y='+c[1]]);    }

Далее получаю значение левого верхнего угла ячейки, по которой был щелчок мыши

procedure TMainForm.UniDBGrid1AjaxEvent(Sender: TComponent;
  EventName: string; Params: TUniStrings);
begin
  if EventName = 'CellXY' then
  begin
    CellLeft:= Params['x'].AsInteger;
    CellTop := Params['y'].AsInteger
  end;
end;
 
Link to comment
Share on other sites

17 hours ago, stas said:

Что-то мудрите, думаю хинтами проще.

Задал вопрос, самостоятельно нашел ответ по форуму - проверил, работает - выложил решение.

Может кому-то пригодится.  Все остальное - от лукавого.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...