TRzPageControl: TabCAPTION DragOver?

Components on the Raize Panels palette: panels, group bars, page controls, splitters, toolbars, status bars, group boxes, etc.

TRzPageControl: TabCAPTION DragOver?

Postby PeterPanino » Fri May 04, 2018 5:14 pm

I have a TRzPageControl in a VCL application. I need to get notified when I drag a file from Windows Explorer to a TAB CAPTION, so when this tab is inactive I can activate it.

Dragging a file to the Tab client area does work well for the Tab I have registered for File Drop. But not for the Tab's caption area.

So how can I get notified when dragging a file to the TAB CAPTION?

PS: I have now tried the TRzPageControl.OnMouseMove event-handler, but unfortunately it does not tell me which Tab Caption the mouse is over.

PS: The TRzPageControl.OnMouseActivate event-handler has a HitTest parameter, but this event-handler is triggered only when CLICKING on a tab caption.

PS: Aaahhh, I have discovered that TRzPageControl.HotTrackIndex can tell me which tab caption the mouse is over in the OnMouseMove event-handler. I am almost at it!

PS: Theoretically, this code should work:

Code: Select all
procedure TForm1.RzPageControl1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
  if (RzPageControl1.HotTrackIndex = RzPageControl1.ActivePageIndex) or
     (RzPageControl1.ActivePageIndex = -1) then EXIT;

  if GetKeyState(VK_LBUTTON) < 0 then
    RzPageControl1.ActivePageIndex := RzPageControl1.HotTrackIndex;
end;


But unfortunately, it does not work because the program or Windows is busy dragging the file from Windows Explorer. Which means that the OnMouseMove event-handler is not even called!

So how can I solve this problem?

PS: Another way would be to register the whole RzPageControl1 as a drop target for files and then activate the tab where the mouse is over its caption in the DragOver event-handler. But how can I detect which tab-caption the mouse is over in the DragOver event-handler? That would imply identifying the tab-caption under the mouse from the mousepointer's X/Y position. How can I do that?
PeterPanino
 
Posts: 3
Joined:
Sun Dec 17, 2017 10:03 pm

Re: TRzPageControl: TabCAPTION DragOver?

Postby PeterPanino » Sat May 05, 2018 5:45 am

Now I registered the whole RzPageControl1 as FileDropTarget and so I get the respective DragOver event-handler triggered when dragging a file from Windows Explorer to the tab-caption area.

Then I try to get the tab-index with "TTCHitTestInfo":
Code: Select all
procedure TformPaRun.DropFileTargetPageCtrlDragOver(Sender: TObject; ShiftState:
    TShiftState; APoint: TPoint; var Effect: Integer);
var
  hi: TTCHitTestInfo;
  tabindex: Integer;
begin
  hi.pt := APoint;
  hi.flags := 0;
  tabindex := SendMessage(RzPageControl1.Handle, TCM_HITTEST, 0, Integer(@hi));
  CodeSite.Send('tabindex', tabindex);
end;


However, with this code tabindex is always 0 (zero). What am I doing wrong?
PeterPanino
 
Posts: 3
Joined:
Sun Dec 17, 2017 10:03 pm

Re: TRzPageControl: TabCAPTION DragOver?

Postby Raize Support » Sat May 05, 2018 9:41 pm

Hi

I would suggest calling the TabAtPos method to get the tab index located at the X, Y position.

Ray
Raize Software Support
Raize Software
http://www.raize.com
Raize Support
 
Posts: 613
Joined:
Fri Mar 25, 2011 9:04 pm

Re: TRzPageControl: TabCAPTION DragOver?

Postby PeterPanino » Sun May 06, 2018 5:35 am

Raize Support wrote:Hi

I would suggest calling the TabAtPos method to get the tab index located at the X, Y position.

Ray


Hi Ray,

thank you very much!
PeterPanino
 
Posts: 3
Joined:
Sun Dec 17, 2017 10:03 pm


Return to Panels

Who is online

Users browsing this forum: No registered users and 1 guest

cron