mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-05 09:57:04 +01:00
LCL, fixed TabIndexAtClientPos for win32 and gtk2
git-svn-id: trunk@18831 -
This commit is contained in:
parent
d165265aaa
commit
af721847eb
@ -527,13 +527,23 @@ var
|
||||
TabWidget: PGtkWidget;
|
||||
PageWidget: PGtkWidget;
|
||||
NotebookPos: TPoint;
|
||||
Window: PGdkWindow;
|
||||
WindowOrg,ClientOrg: TPoint;
|
||||
Count: guint;
|
||||
begin
|
||||
Result:=-1;
|
||||
NoteBookWidget:=PGtkNotebook(ANotebook.Handle);
|
||||
if (NotebookWidget=nil) then exit;
|
||||
//DebugLn(['TGtkWSCustomNotebook.GetTabIndexAtPos ',GetWidgetDebugReport(PGtkWidget(NotebookWidget))]);
|
||||
{$IFDEF GTK2}
|
||||
Window := GetControlWindow(NoteBookWidget);
|
||||
gdk_window_get_origin(Window,@WindowOrg.X,@WindowOrg.Y);
|
||||
ClientOrg:=GetWidgetClientOrigin(PGtkWidget(NotebookWidget));
|
||||
NotebookPos.X:= AClientPos.X + (ClientOrg.X-WindowOrg.X);
|
||||
NotebookPos.Y:= AClientPos.Y + (ClientOrg.Y-WindowOrg.Y);
|
||||
{$ELSE}
|
||||
NotebookPos:=AClientPos;
|
||||
{$ENDIF}
|
||||
// go through all tabs
|
||||
Count:=g_list_length(NoteBookWidget^.Children);
|
||||
for i:=0 to Count-1 do begin
|
||||
|
||||
@ -610,8 +610,11 @@ class function TWin32WSCustomNotebook.GetTabIndexAtPos(const ANotebook: TCustomN
|
||||
const AClientPos: TPoint): integer;
|
||||
var
|
||||
hittestInfo: TC_HITTESTINFO;
|
||||
Orect: TRect;
|
||||
begin
|
||||
hittestInfo.pt := AClientPos;
|
||||
GetLCLClientBoundsOffset(ANotebook, ORect);
|
||||
hittestInfo.pt.x:= AClientPos.x + ORect.Left;
|
||||
hittestInfo.pt.y:= AClientPos.y + ORect.Top;
|
||||
Result := Windows.SendMessage(ANotebook.Handle, TCM_HITTEST, 0, LPARAM(@hittestInfo));
|
||||
end;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user