Get DocViewsArea rectangle/coordinates inside its MainView/MainFrame (for Drag'n'Drop implementation)  SOLVED

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Get DocViewsArea rectangle/coordinates inside its MainView/MainFrame (for Drag'n'Drop implementation)

Post by zarkogajic »

Hi support,

I'm implementing my Drag&Drop functionality for the pxv_Control.

Is there a way to get the coordinates / rectangle of (IPXV_Control.Frame.View.) DocViewsArea ?

Why: when accepting files (my OnDragOver event) I want to accept only if the mouse cursor is above the DocViewsArea and not above CommandPanes (or alike) of the MainView.

-žarko
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: Get DocViewsArea rectangle/coordinates inside its MainView/MainFrame (for Drag'n'Drop implementation)

Post by zarkogajic »

For info:

IUIX_Obj has ClientRectToScreen which I thought I could use.

However,

Code: Select all

  mvObj, dcvObj :IUIX_Obj;
  stClient, mvRectScreen, dvaRectScreen : tagRect;
... //pxv is pxv_Control
    mvObj := pxv.Frame.View.Obj;
    dcvObj := pxv.Frame.View.DocViewsArea.Obj;

    stClient := mvObj.ClientRect;
    mvObj.ClientRectToScreen(stClient, mvRectScreen);

    stClient := dcvObj.ClientRect;
    dcvObj.ClientRectToScreen(stClient, dvaRectScreen);
After the above mvRectScreen is the same (Top, Left, Bottom, Right) as dvaRectScreen.

I would expect dvaRectScreen is "inside" mvRectScreen as there are some CommanPanes above the DocViewsArea within the MainView - so at least the Top of dvaRectScreen should be > mvRectScreen.Top,

...

Trying with pxv.Frame.Obj ... and yes, we have an offset :) .. so case closed (kind of)!

However, according to SDK help for IPXV_MainFrame MainFrame and MainView should have the same (transferred to screen) coordinates ?!



-žarko
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Get DocViewsArea rectangle/coordinates inside its MainView/MainFrame (for Drag'n'Drop implementation)

Post by Sasha - Tracker Dev Team »

Hello žarko,

That illustration is for basic understanding purposes - the Frame/View/DocViewsArea coordinates would be the same if no command bars are shown. If you have shown them then here's what you will get (for example):
image.png
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: Get DocViewsArea rectangle/coordinates inside its MainView/MainFrame (for Drag'n'Drop implementation)

Post by zarkogajic »

Hi Alex,

Thanks. Can you double check this :)

I have commandPane visible.

Here's the code:

Code: Select all

var
  mf : IPXV_MainFrame;
  mv : IPXV_MainView;
  dva : IPXV_DocumentViewsArea;
  cr, sr : tagRect;
begin
  mf := PDFXHelper.Inst.MainFrm[0];
  mv := mf.View;
  dva := mv.DocViewsArea;

  cr := mf.Obj.ClientRect;
  mf.Obj.ClientRectToScreen(cr, sr);
  memog.Lines.Add(Format('MainFrame.Top:%d', [sr.top]));

  cr := mv.Obj.ClientRect;
  mv.Obj.ClientRectToScreen(cr, sr);
  memog.Lines.Add(Format('MainView.Top:%d', [sr.top]));

  cr := dva.Obj.ClientRect;
  dva.Obj.ClientRectToScreen(cr, sr);
  memog.Lines.Add(Format('DocViewsArea.Top:%d', [sr.top]));
end;

And here's the result:
MainFrame.Top:285
MainView.Top:345
DocViewsArea.Top:345
Note that MainView and DocViewssArea have the same Top value.


-žarko
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Get DocViewsArea rectangle/coordinates inside its MainView/MainFrame (for Drag'n'Drop implementation)

Post by Sasha - Tracker Dev Team »

Hello žarko,

Yup that is the same result that i'm getting so it is correct.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: Get DocViewsArea rectangle/coordinates inside its MainView/MainFrame (for Drag'n'Drop implementation)

Post by zarkogajic »

Thanks Alex,

But then this image is not correct: https://sdkhelp.pdf-xchange.com/vi ... nFrame.PNG

Main View is not MainFrame in terms of rectangle.


Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Get DocViewsArea rectangle/coordinates inside its MainView/MainFrame (for Drag'n'Drop implementation)  SOLVED

Post by Sasha - Tracker Dev Team »

Hello žarko,

In terms of rectangles - no, but in terms of visualization, understanding and structure this can be drawn like so - you are the first dev. who got this deep into our control tweaking, thus nobody even asked about such things before.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: Get DocViewsArea rectangle/coordinates inside its MainView/MainFrame (for Drag'n'Drop implementation)

Post by zarkogajic »

Hi Alex,
you are the first dev. who got this deep into our control tweaking, thus nobody even asked about such things before.
Omg! And I'm just starting to (believing that I am able to) control this magnificent and untamed beast of your Editor SDK ;) So expect some real questions coming up ...

p.s.
I'm actually not tweaking anything yet - only a few custom commands / bars. All the tweaking so far is related to working with multiple pxv_instances ... and slowly we are progressing ...

Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Get DocViewsArea rectangle/coordinates inside its MainView/MainFrame (for Drag'n'Drop implementation)

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply