Working with MDI

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

TatianaS
User
Posts: 103
Joined: Mon Mar 18, 2013 4:26 pm

Working with MDI

Post by TatianaS »

Hello,
I am working on MDI app and wandering if your API supports Window operations like:

Maximize
Minimize All
Arrange Icons

Also, I would need to catch an event when user switches from one opened document to an other in my MDI, so I can do some actions as well...

Thanks,
-Tatiana
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19868
Joined: Mon Jan 12, 2009 8:07 am

Re: Working with MDI

Post by Stefan - PDF-XChange »

Hi Tatiana,

Will this help?
https://forum.pdf-xchange.com/ ... 36&t=10652

Regards,
Stefan
TatianaS
User
Posts: 103
Joined: Mon Mar 18, 2013 4:26 pm

Re: Working with MDI

Post by TatianaS »

Not really, I import .dat configuration I created in the viewer and set it up as MDI that way.
What I am looking for is more information about your API for MDI.
Events like on Close Document, on Document select, etc.
Also, child window operations like: Maximize, Minimize All, Arrange Icons

Tanks,
Tatiana
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: Working with MDI

Post by Vasyl - PDF-XChange »

Hi, Tatiana

As I understand you - you have a standard MDI and each MDI-child embeds our ActiveX Control. In this case you have some separated ActiveX
controls and each control "don't know" about others. In this case I can suggest you the next way:
firstly you must attach your event-listener to each instance of our ActiveX (may be new listener for new control) and you will be able to intercept one special event about focus changing inside the controls:

Code: Select all

youreventhandler ChildFrame::OnEvent(type, name, ...)
{
    if ((type == PXCVA_OnNamedNotify) AND (name == Global::FocusGained))
    {
         // statrt timer to lazy update UI by possible activation of new document
         mainFrame.StartTimer(LASY_UPDATE_MDI_ACTIVATION_TIMER_ID, 50); // 50ms
         return;
    }
}

HWND g_hWndLastActiveMDIChild = NULL;

MainFrame::OnTimer(timerID)
{
    if (timerID == LASY_UPDATE_MDI_ACTIVATION_TIMER_ID)
    {
         StopTimer(timerID);

         HWND hWndActiveMDIChild = mainFrame.MDIGetActive();
         if (g_hWndLastActiveMDIChild != hWndActiveMDIChild)
         {
              g_hWndLastActiveMDIChild = hWndActiveMDIChild;
              OnNewMDIChildActivated(hWndActiveMDIChild);
         }
    }  
}
OR you may handle WM_NCACTIVATE standard message from your MDI-child window. It might be more correct way.

HTH
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
TatianaS
User
Posts: 103
Joined: Mon Mar 18, 2013 4:26 pm

Re: Working with MDI

Post by TatianaS »

I do have only one ActiveX control configured as MDI.
Could you maybe provide API call on how to set a child window to maximize or minimize mode.

Thanks,
Tatiana
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: Working with MDI

Post by Vasyl - PDF-XChange »

Hi, Tatiana.

Use next UI-commands:
"CascadeWindows"
"TileWindowsHorizontal"
"TileWindowsVertical"
"ArrangeWindowIcons"

But currently is no way to maximize/minimize/restore of internal mdi-child window.. It is possible to add it in the future but not in neard future because we are too busy with our new PDF-Editor's EU/SDK..
Also, I would need to catch an event when user switches from one opened document to an other in my MDI, so I can do some actions as well...
To be clear - what means your "in my MDI" ? Do you meaning the your MDI App which embedds our ActiveX(that is also in own 'MDI' mode) ?
In any case - no events from our ActiveX about changing of internal focus or re-activating of any internal windows. Only one named notify exists - "Documents.Active" - notifies about document activating.

HTH.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
TatianaS
User
Posts: 103
Joined: Mon Mar 18, 2013 4:26 pm

Re: Working with MDI

Post by TatianaS »

Thanks, the UI-commands work, but because I am not using your Menu bar, the Minimize, Restore Down and Close menu buttons (see attachment) are not visible for me when multiple documents are opened and one of them is maximized.
I am planning on painting those buttons myself on my menu bar, and I would need to change page properties: Pages.Height, Pages.Width and Pages.ScreenX and Pages.ScreenY (for minimize) accordingly.

I have tried this Delphi code, but it doesn't do anything:

DataIn := 20;
fCoPDFXCview.DoVerb('Documents[#'+IntToStr(activeDocID)+'].Pages[0].Width', 'set', DataIn, DataOut, 0);

So, how can I get Minimize and Restore Down to work with page sizing or any other way?

Can you tell me maybe what events are triggered from your side, maybe I could create these events on my side?

Thanks,
Tatiana
You do not have the required permissions to view the files attached to this post.
TatianaS
User
Posts: 103
Joined: Mon Mar 18, 2013 4:26 pm

Re: Working with MDI

Post by TatianaS »

I forgot to mention that I do not allow tabs in MDI, so that multiple documents can be viewed side by side.
I also tried to import settings from .dat file with your menu which displays Minimize, Restore Up and Close buttons when document is maximized. Unfortunately there is bug, the buttons work only when Mouse Focus is reset.

Steps:
1. Open document
2. Maximize document
3. Click on Minimize or Restore Up

Result: No events are triggered

4. Click away from the application
5. Click on Minimize or Restore Up

Result: Event is triggered and Minimize or Restore Up work

Please note that I have no code in onEvent when testing this.
Please help, this is essential part of the MDI view

Thanks,
Tatiana
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: Working with MDI

Post by Vasyl - PDF-XChange »

Hi, Tatiana.
I am planning on painting those buttons myself on my menu bar, and I would need to change page properties: Pages.Height, Pages.Width and Pages.ScreenX and Pages.ScreenY (for minimize) accordingly.
The Page.Width/Page.Height are readonly properties and contain the physical width/height of PDF-page. It cannot be used for maximize/restore of our internal mdi-child. Currently you cannot manage state(normal/minimized/maximized) of our mdi-child - we have no any functionality for this. This feature can be added a bit later.
Unfortunately there is bug, the buttons work only when Mouse Focus is reset.
Confirmed. This bug will be fixed in the next build. Thanks for your report.

Best
Regards.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
TatianaS
User
Posts: 103
Joined: Mon Mar 18, 2013 4:26 pm

Re: Working with MDI

Post by TatianaS »

Thanks your help, when is the next build is going to go out?
TatianaS
User
Posts: 103
Joined: Mon Mar 18, 2013 4:26 pm

Re: Working with MDI

Post by TatianaS »

Also, is there a way to hide 'Edit' menu. I need to have it when I export my settings from the Viewer, but need to hide when it is used in my app because I have my own menu.

Thanks.
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: Working with MDI

Post by Vasyl - PDF-XChange »

Thanks your help, when is the next build is going to go out?
I cannot say exactly when but I hope - it can be in January..
Also, is there a way to hide 'Edit' menu. I need to have it when I export my settings from the Viewer, but need to hide when it is used in my app because I have my own menu.
You may hide/show menu-bar or any toolbar by:

Code: Select all

pdfViewer.SetProperty("View.Bars[\"Menu\"].Visible", "false", 0);
pdfViewer.SetProperty("View.Bars[\"File\"].Visible", "true", 0);
But currently is impossible to change programmatically the content of toolbar/menu. Otherwise you may remove the 'Edit' element from menu like end-user using "Customize" feature (to remove element from bar - activate customize mode, press mouse button on the unnecessary element and move it outside of any bar and then drop) and then export settings to an external file. After this you will be able load these custom settings to your control at each start...
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
TatianaS
User
Posts: 103
Joined: Mon Mar 18, 2013 4:26 pm

Re: Working with MDI

Post by TatianaS »

How can I export my setting if the 'Edit' menu is removed (it contains the export functionality).
Is there any shortcut keys I can use?
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19868
Joined: Mon Jan 12, 2009 8:07 am

Re: Working with MDI

Post by Stefan - PDF-XChange »

Hi Tatyana,


Vasyl asked me to make a ticket in our system for this forum topic:
#2158: ActiveX: trouble with MDI-buttons. New MDI-features required.
So that we can resolve that for you.

Regards,
Stefan
TatianaS
User
Posts: 103
Joined: Mon Mar 18, 2013 4:26 pm

Re: Working with MDI

Post by TatianaS »

Thank you so much. You guys are great :D
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19868
Joined: Mon Jan 12, 2009 8:07 am

Re: Working with MDI

Post by Stefan - PDF-XChange »

:)
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: Working with MDI

Post by Vasyl - PDF-XChange »

How can I export my setting if the 'Edit' menu is removed (it contains the export functionality).
Is there any shortcut keys I can use?
Yes, you may use shortcut but you should assign the new shortcut to the UI-command in [Menu/View/Toolbars/Customize Dialog/Commands Tab/Edit Category/Export All Settings to Data File command], because is no any shortcut for this command by default..
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
TatianaS
User
Posts: 103
Joined: Mon Mar 18, 2013 4:26 pm

Re: Working with MDI

Post by TatianaS »

Thanks, that worked. :D
User avatar
Paul - PDF-XChange
Site Admin
Posts: 7361
Joined: Wed Mar 25, 2009 10:37 pm

Re: Working with MDI

Post by Paul - PDF-XChange »

:D
Best regards

Paul O'Rorke
PDF-XChange Support
http://www.pdf-xchange.com
TatianaS
User
Posts: 103
Joined: Mon Mar 18, 2013 4:26 pm

Re: Working with MDI

Post by TatianaS »

Hello,
I seem that the ticket #2158 was not resolved in the latest build. This is very important MDI feature and we will not be able to release our app without it. Could you please give me an approximate date when this can be fixed?

Thank you
Tatiana
TatianaS
User
Posts: 103
Joined: Mon Mar 18, 2013 4:26 pm

Re: Working with MDI

Post by TatianaS »

Hello,
could you please reply to my question bellow...

Thanks,
Tatiana
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19868
Joined: Mon Jan 12, 2009 8:07 am

Re: Working with MDI

Post by Stefan - PDF-XChange »

Hi TatianaS,

I've just asked for an update on when ticket #2158 is expected to be fixed and will post here as soon as I have the update.

Regards,
Stefan
TatianaS
User
Posts: 103
Joined: Mon Mar 18, 2013 4:26 pm

Re: Working with MDI

Post by TatianaS »

thanks
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: Working with MDI

Post by Vasyl - PDF-XChange »

Hi, Tatiana.
#2158: ActiveX: trouble with MDI-buttons. New MDI-features required.
Some details about new MDI-features in new build (upcoming). Added new simple operations:

"MDIRestore",
"MDIRestoreAll",
"MDIMaximize",
"MDIMinimize",
"MDIMinimizeAll",
"MDICascade",
"MDITile",
"MDITileHorz",
"MDIIconArrange",
"MDIClose",

To use it:

pdfViewer.DoVerb("", "MDIMaximize", stub, null, 0);

Best
Regards.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
TatianaS
User
Posts: 103
Joined: Mon Mar 18, 2013 4:26 pm

Re: Working with MDI

Post by TatianaS »

Thanks, that a great news. I already have been using these commands for tiling and they work great:

fCoPDFXCview.DoVerb('', 'ExecuteCommand', 'Cascade', dataOut, 0);
fCoPDFXCview.DoVerb('', 'ExecuteCommand', 'TileHorizontal', dataOut, 0);
fCoPDFXCview.DoVerb('', 'ExecuteCommand', 'TileVertical', dataOut, 0);

I will not be using "MDIMaximize", "MDIRestore", etc myself, but rather expect your component to do it correctly when
I click on the MDI buttons (located on the main menu bar).

Thanks,
Tatiana
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19868
Joined: Mon Jan 12, 2009 8:07 am

Re: Working with MDI

Post by Stefan - PDF-XChange »

Glad to hear these are working now Tatiana!

Cheers,
Stefan