FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour EMF-Viewer How to do?
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
EMF-Viewer How to do?
Posted: Sat Feb 16, 2008 10:59 AM
I would like to have a EMF-Viewer.

At the leftt site of the window the available emf files should be shown
and an on click should show the preview on the right site.

In my case Preview opens in a maximized window.
Does someone know how to do?




#include "FiveWin.ch"
#include "InKey.ch"
#include "xbrowse.ch"
//----------------------------------------------------------------------------//

function Main()

local oWnd
local oBrw, oCol
local oRes, cRes
LOCAL aInhalt := directory("*.emf","D")
LOCAL oFnt
LOCAL ob0, ob1, ob2, ob3, ob4, ob5, xRes

DEFINE FONT oFnt NAME "ARIAL" SIZE 6 ,15 BOLD

DEFINE WINDOW oWnd TITLE "EMF-Viewer" ;
FROM 0,0 TO 800,1024 PIXEL
oWnd:SetFont(oFnt)

oBrw := TXBrowse():New( oWnd )
oBrw:nTop := 10
oBrw:nLeft := 20
oBrw:nBottom := 600
oBrw:nRight := 330

oBrw:SetArray( ainHalt, .T. )
oBrw:aCols[1]:cHeader := 'Source'
oBrw:aCols[1]:nWidth := 157

oBrw:aCols[2]:cHeader := 'Size'
oBrw:aCols[3]:cHeader := 'Date'

oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROW
oBrw:nRowDividerStyle := 4

oBrw:lRecordSelector := .t.


oBrw:bLDblClick := {|| CreateChild( oBrw) }

oBrw:bKeyDown := {|nkey| iF( nkey = 13, CreateChild( oBrw), ) }

oBrw:lHScroll := .f.

oBrw:CreateFromCode()

@ 650, 350 BUTTON ob0 PROMPT "&Open" OF oWnd PIXEL SIZE 80,30;
ACTION CreateChild( oBrw)

@ 650, 870 BUTTON "&Exit" OF oWnd PIXEL SIZE 80,30;
ACTION oWnd:end()

ACTIVATE WINDOW oWnd
return nil


//----------------------------------------------------------------------------//
function CreateChild( oBrw)

local oPrn
local cFileName := oBrw:aArrayData[oBrw:nArrayAt,1]

PRINTER oPrn PREVIEW
PAGE
oPrn:ImportWMF( cFileName )
ENDPAGE
ENDPRINT

return nil

//----------------------------------------------------------------------------//


Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Preview of WMF-File
Posted: Sun Feb 17, 2008 05:14 PM

Hallo Otto,

why not to do this with Outlook2003.
The right window will have the format you need
and looks much better.

Regards
Uwe :lol:

Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
EMF-Viewer How to do?
Posted: Sun Feb 17, 2008 07:10 PM

Hello Uwe,
You are right and I tried. But preview always opens maximized.
Maybe you – as you have worked so much now with the Outlook class - can provide a little example.

As a workaround I changed the rpreview
I deleted maximize and set
DEFINE WINDOW ::oWnd FROM 2, 42 TO 40, 127 ;

But every click opens a new preview window.

Regards,
Otto

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Preview in Outlook2003 - Child
Posted: Sun Feb 17, 2008 08:56 PM

Hello Otto,

I got it working.
I created a new Button in the DB-Tools Outlook-part.
The Preview-window is now a Child of the created button and has
the size and positons like the other functions.

The next stepp would be, how the preview fits the window.
I will do some tryouts.

Greetings
Uwe :lol:

Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
EMF-Viewer How to do?
Posted: Mon Feb 18, 2008 12:30 AM
Hello Uwe,
I did some test with Outlook class, too.

Now I have to resolve the problem that every time you click on the xBrowser a new Preview is opened.
I would prefer to close the current and then open the new one.


Regards,
Otto

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Outlook2003 and Preview
Posted: Mon Feb 18, 2008 01:34 AM

Hello Otto,

can you send me the part, of what you have done ?
I can connect it to a button of the Tools.
The code of the changed Outlook part, i can send back to you.
So as well, it might be a good sample.

Greetings
Uwe

Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
EMF-Viewer How to do?
Posted: Mon Feb 18, 2008 07:38 AM

Hello Uwe,

the code is on http://www.atzwanger.com/tests/emf.zip

I changed for testing purpose rpreview.prg

METHOD Activate() CLASS TPreview
// ACTIVATE WINDOW ::oWnd MAXIMIZED ;
Changed to
ACTIVATE WINDOW ::oWnd ;

METHOD BuildWindow() CLASS TPreview

  DEFINE WINDOW ::oWnd  ;
     TITLE cTitle ;
     COLOR CLR_BLACK,CLR_LIGHTGRAY      ;
     ICON  oIcon                        ;
     VSCROLL HSCROLL MDICHILD   STYLE nOR( WS_CAPTION)

Inserted:
STYLE nOR( WS_CAPTION)

     WndTop( ::oWnd:hWnd, 0)
    //WndLeft( ::oWnd:hWnd, (::oWndMain:nwidth() - ::oWnd:nwidth())-16 )
    WndLeft( ::oWnd:hWnd, 200)
   ::oWnd:nHeight :=  ::oWndMain:nHeight()  -80
  1. I don’t understand why
    WndLeft( ::oWnd:hWnd, (::oWndMain:nwidth() - ::oWnd:nwidth())-16 )
    Is not working if you resize the width of the outlook splitter.
    If I use a fixed value of 200 it works also if you resize:
    WndLeft( ::oWnd:hWnd, 200)

  2. I can’t find out the original emf-file’s name. I thought to insert
    the name in the title of the window and to check previous to open a new window if the file is already shown.

  3. Do you know the name and the size of the FONT use in the bitmaps for the outlook menu?

Regards,
Otto

Continue the discussion