while , I have to close dialog to view the preview window
my:source
#include "FiveWin.ch"
#include "InKey.ch"
#include "xbrowse.ch"
REQUEST DBFCDX
STATIC oSayTEST
STATIC oDbf
static oWnd
//----------------------------------------------------------------------------//
function Main()
SET DELETED ON
set(4,'dd.mm.yyyy')
rddsetdefault( "DBFCDX" )
public DOT_M:='.'
public DRIVERS1_M:='DBFNTX'
public DRIVERS2_M:='DBFCDX'
public ROK_M:=year(date())
public MSC_M:=month(date())
STAN_KAT:=".\BAZY\"
rddsetdefault( "DBFCDX" )
SET _3DLOOK ON // Microsoft 3D Look
DEFINE FONT oFont NAME "ARIAL CE" SIZE 0, -12
DEFINE WINDOW oWnd TITLE "Test" ;
MENU BuildMenu();
MENUINFO 3
SET MESSAGE OF oWnd TO FWVERSION + FWCOPYRIGHT CLOCK DATE
ACTIVATE WINDOW oWnd on INIT oWnd:Center() //ON INIT (iif(password(),'',oWnd:end()) )
return nil
//----------------------------------------------------------------------------//
function BuildMenu()
local oMenu
MENU oMenu
MENUITEM "Ewidencja"
MENU
MENUITEM "Waga" ;
ACTION wazenie( oWnd )
ENDMENU
MENUITEM "Koniec"
MENU
MENUITEM "Koniec" ACTION oWnd:end ;
MESSAGE OemToAnsi( "Koniec pracy" )
ENDMENU
ENDMENU
return oMenu
//----------------------------------------------------------------------------//
function wazenie()
local oDlg
local oLbx
local cVar
local oFONT
local n
begin sequence
if !zbio_wag()
break
endif
DEFINE DIALOG oDlg FROM 0, 0 TO 600, 800 PIXEL;
TITLE "Lista ważeń"
@ 5, 5 LISTBOX oLbx FIELDS dtoc(waga->data),waga->nr_rej, waga->samochod,waga->kierowca,waga->opis,transform(waga->waga,'999,999,999.99') ;
HEADERS "Data", "Nr rej", "Samochód", "Kierowca","Opis", "Waga" ;
FIELDSIZES 80, 100, 100, 150, 200, 120, 120 ;
SIZE 380, 250 PIXEL OF oDlg
oLbx:nLineStyle = 1
oLbx:aJustify = { .f., .f., .f., .f., .f., .t. }
@ 270,145 BUTTON "&Print" OF oDlg ACTION dr_wag(oDlg,oLbx) SIZE 30, 12 PIXEL
ACTIVATE DIALOG oDlg CENTER
//AEval( aHBitmaps, { | hBmp | DeleteObject( hBmp ) } )
end sequence
DBCLOSEALL()
return nil
******************************************************************************
function ZBIO_WAG(wsk_sel, wsk_open, wsk_alias, wsk_shared, wsk_read)
local skad_baz,wynik:=.t.
local wsk_o,wsk_a,wsk_s,wsk_r
wsk_o:=iif(wsk_open=NIL, stan_kat, wsk_open)
wsk_a:=iif(wsk_alias=NIL, 'WAGA', wsk_alias)
wsk_s:=iif(wsk_shared=NIL, .t., .f.)
wsk_r:=iif(wsk_read=NIL, .f., .t.)
begin sequence
skad_baz=alltrim(wsk_o)+'WAGA'+DOT_M+'DBF'
dbusearea(.t.,DRIVERS2_M,skad_baz,wsk_a,wsk_s,wsk_r)
if neterr()
alert('Baza '+skad_baz+' zaj‘ta.')
break
end
dbsetorder(1)
recover
wynik:=.f.
end
RETURN (wynik)
//----------------------------------------------------------------------------//
function dr_wag(oDlg)
LOCAL oPrn, oFnt
LOCAL nHStep, nVStep
PRINT oPrn PREVIEW MODAL
DEFINE FONT oFnt NAME "Arial CE" SIZE 0, -10 OF oPrn
nHStep = oPrn:nHorzRes() / 80
nVStep = oPrn:nVertRes() / 66
oPrn:SetPortrait()
PAGE
oPrn:Say( 0, 0, "REAL SA", oFnt )
oPrn:Say( 1 * nVStep, 0, "08-110 Siedlce", oFnt )
oPrn:Say( 2 * nVStep, 0, "ul. Brzeska 176", oFnt )
oPrn:Say( 4 * nVStep, 0, "Raport ważenia:", oFnt )
oPrn:Say( 5 * nVStep, 0, "-------------------------------------------------------------", oFnt )
oPrn:Say( 6 * nVStep, 0, "Data :"+dtoc(data), oFnt )
oPrn:Say( 7 * nVStep, 0, "Nr rej :"+nr_rej, oFnt )
oPrn:Say( 8 * nVStep, 0, "Kierowca:"+Kierowca, oFnt )
oPrn:Say( 9 * nVStep, 0, "Opis :"+Opis, oFnt )
oPrn:Say(10 * nVStep, 0, "Waga :"+transform(waga,'999,999,999.99')+' kg', oFnt )
oPrn:Say(14 * nVStep, 0, "/ sporządził /", oFnt )
ENDPAGE
ENDPRINT
RELEASE FONT oFnt
return nil
//--------------------------------------------------------
best regards
kajot