EMF-Viewer How to do?

EMF-Viewer How to do?

Postby Otto » 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?

Image

#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

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


User avatar
Otto
 
Posts: 6272
Joined: Fri Oct 07, 2005 7:07 pm

Preview of WMF-File

Postby ukoenig » Sun Feb 17, 2008 5: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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby Otto » Sun Feb 17, 2008 7: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
User avatar
Otto
 
Posts: 6272
Joined: Fri Oct 07, 2005 7:07 pm

Preview in Outlook2003 - Child

Postby ukoenig » Sun Feb 17, 2008 8: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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby Otto » 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

Image
User avatar
Otto
 
Posts: 6272
Joined: Fri Oct 07, 2005 7:07 pm

Outlook2003 and Preview

Postby ukoenig » Mon Feb 18, 2008 1: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
Last edited by ukoenig on Mon Feb 18, 2008 11:19 am, edited 1 time in total.
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby Otto » Mon Feb 18, 2008 7: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
User avatar
Otto
 
Posts: 6272
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 22 guests