Recent

Author Topic: TabIndexAtClientPos always returns -1  (Read 4012 times)

AlvaroPB

  • Newbie
  • Posts: 5
TabIndexAtClientPos always returns -1
« on: June 04, 2009, 05:59:51 pm »
Hi,

I click on TPageControl tab's headline and check on the event OnMouseDown:

Code: [Select]
procedure TForm1.PageControl1MouseDown(Sender: TOBject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
  index : Integer;
begin
  if Button = mbRight then begin
    index := PageControl1.TabIndexAtClientPos(Point(X,Y));
    //with ScreenToClient don't work too
    //index := PageControl1.TabIndexAtClientPos(PageControl1.ScreenToClient(Point(X, Y)));
    Label1.Caption := IntToStr(index);
  end;
end;

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
Re: TabIndexAtClientPos always returns -1
« Reply #1 on: June 04, 2009, 09:32:13 pm »
On what operating system with what widget set did you test it?

AlvaroPB

  • Newbie
  • Posts: 5
Re: TabIndexAtClientPos always returns -1
« Reply #2 on: June 04, 2009, 10:23:30 pm »
I tested on Windows XP and Vista.

The X coordinate is correct, but the Y is a negative number.
Changing the Y's value to a constant value, like 5, the code below return the correct index:

index := PageControl1.TabIndexAtClientPos(Point(X,5));

Sorry for my poor english.

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
Re: TabIndexAtClientPos always returns -1
« Reply #3 on: June 04, 2009, 10:28:33 pm »
Please, create a bug report with an example program.

AlvaroPB

  • Newbie
  • Posts: 5
Re: TabIndexAtClientPos always returns -1
« Reply #4 on: June 04, 2009, 10:49:11 pm »
OK. I'll do it.

 

TinyPortal © 2005-2018