how can i create a small preview in a dialog?
i need it to calibrate the lottery slips
Small RPreview
- Silvio.Falconi
- Posts: 7104
- Joined: Thu Oct 18, 2012 7:17 pm
Small RPreview
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
- nageswaragunupudi
- Posts: 10691
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Small RPreview
This is a small sample program.
Please modify the size of the dialog as per your needs.
Code: Select all | Expand
#include "fivewin.ch"
function Main()
local oPrn
SetCustomPrintPreview( { |o| DlgPreview( o ) } )
PRINT oPrn PREVIEW
oPrn:SetPage( 11 )
PAGE
@ 1,1 PRINT TO oPrn IMAGE "..\bitmaps\olga1.jpg" ;
SIZE 9,29 CM ALIGN "T"
ENDPAGE
PAGE
@ 1,1 PRINT TO oPrn IMAGE "..\bitmaps\sea.bmp" ;
SIZE 9,29 CM ALIGN "T"
ENDPAGE
ENDPRINT
SetCustomPrintPreview( nil )
return nil
function DlgPreview( oPrn )
local oDlg, oBar, oImage, nPage := 1
local lBar := Len( oPrn:aMeta ) > 1
DEFINE DIALOG oDlg SIZE 300,400 PIXEL TRUEPIXEL RESIZABLE
if lBar
DEFINE BUTTONBAR oBar OF oDlg SIZE 32,40 2010 NOBORDER
endif
@ If( lBar, 60, 20 ),20 XIMAGE oImage SOURCE oPrn:aMeta[ 1 ] SIZE -20,-20 OF oDlg
if lBar
DEFINE BUTTON OF oBar RESOURCE FWBitmap( "top2" ) ;
WHEN nPage > 1 ;
ACTION oImage:SetSource( oPrn:aMeta[ nPage := 1 ] )
DEFINE BUTTON OF oBar RESOURCE FwBitmap( "previous2" ) ;
WHEN nPage > 1 ;
ACTION oImage:SetSource( oPrn:aMeta[ --nPage ] )
DEFINE BUTTON OF oBar RESOURCE FWBitmap( "next2" ) ;
WHEN nPage < Len( oPrn:aMeta ) ;
ACTION oImage:SetSource( oPrn:aMeta[ ++nPage ] )
DEFINE BUTTON OF oBar RESOURCE FWBitmap( "bottom2" ) ;
WHEN nPage < Len( oPrn:aMeta ) ;
ACTION ( oImage:SetSource( oPrn:aMeta[ nPage := Len( oPrn:aMeta ) ] ) )
endif
ACTIVATE DIALOG oDlg CENTERED
return nil
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Silvio.Falconi
- Posts: 7104
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Small RPreview
nageswaragunupudi wrote:This is a small sample program.Please modify the size of the dialog as per your needs.Code: Select all | Expand
#include "fivewin.ch" function Main() local oPrn SetCustomPrintPreview( { |o| DlgPreview( o ) } ) PRINT oPrn PREVIEW oPrn:SetPage( 11 ) PAGE @ 1,1 PRINT TO oPrn IMAGE "..\bitmaps\olga1.jpg" ; SIZE 9,29 CM ALIGN "T" ENDPAGE PAGE @ 1,1 PRINT TO oPrn IMAGE "..\bitmaps\sea.bmp" ; SIZE 9,29 CM ALIGN "T" ENDPAGE ENDPRINT SetCustomPrintPreview( nil ) return nil function DlgPreview( oPrn ) local oDlg, oBar, oImage, nPage := 1 local lBar := Len( oPrn:aMeta ) > 1 DEFINE DIALOG oDlg SIZE 300,400 PIXEL TRUEPIXEL RESIZABLE if lBar DEFINE BUTTONBAR oBar OF oDlg SIZE 32,40 2010 NOBORDER endif @ If( lBar, 60, 20 ),20 XIMAGE oImage SOURCE oPrn:aMeta[ 1 ] SIZE -20,-20 OF oDlg if lBar DEFINE BUTTON OF oBar RESOURCE FWBitmap( "top2" ) ; WHEN nPage > 1 ; ACTION oImage:SetSource( oPrn:aMeta[ nPage := 1 ] ) DEFINE BUTTON OF oBar RESOURCE FwBitmap( "previous2" ) ; WHEN nPage > 1 ; ACTION oImage:SetSource( oPrn:aMeta[ --nPage ] ) DEFINE BUTTON OF oBar RESOURCE FWBitmap( "next2" ) ; WHEN nPage < Len( oPrn:aMeta ) ; ACTION oImage:SetSource( oPrn:aMeta[ ++nPage ] ) DEFINE BUTTON OF oBar RESOURCE FWBitmap( "bottom2" ) ; WHEN nPage < Len( oPrn:aMeta ) ; ACTION ( oImage:SetSource( oPrn:aMeta[ nPage := Len( oPrn:aMeta ) ] ) ) endif ACTIVATE DIALOG oDlg CENTERED return nil
sorry Nageswarao maybe I didn't explain myself well, I need a dialog that has a printed coupon on one side and an xbrowse with the data on the other, in the xbrowse there is the data i.e. the coordinates to put a pixel above a position, I need it to calibrate the Italian lottery coupons
I'll draw you a picture of how I would like to make it
on oldest app I use a procedure to insert pixel into coupon
Code: Select all | Expand
oPrn:FillRect( aRect, oBrush )
I thinked to create something of visual , the final use insert data on xbrowse and the procedure put the pixel on image
then I can save the coordinates on archive and printer the coupons
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
- Silvio.Falconi
- Posts: 7104
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Small RPreview
Nages this is my Idea
Now I don't know how I have to draw a black circle for each number and at the same time have the exact coordinates for when I send to the printer
Code: Select all | Expand
#include "FiveWin.ch"
#include "Constant.ch"
Function test()
//dialog
local oDlg, oBrw, oFont, oBold, oCoupon
local nBottom := 34
local nRight := 75
local nWidth := Max( nRight * DLG_CHARPIX_W, 180 )
local nHeight := nBottom * DLG_CHARPIX_H
local aData := {{"numero 1","0.9","27.17"}}
local cTicket:="ticket.jpg"
local oRowAdd,oRowEra
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-10
DEFINE FONT oBold NAME "TAHOMA" SIZE 0,-12 BOLD
DEFINE DIALOG oDlg SIZE nWidth, nHeight ;
PIXEL TRUEPIXEL FONT oFont ; //RESIZABLE FONT oFont
TiTle "Taratura schedina"
//Image
@ 10, 0 XIMAGE oCoupon SIZE 250, 500 OF oDlg SOURCE cTicket NOBORDER
oCoupon:bRClicked := { || NIL }
oCoupon:nUserControl :=0
//xbrowse table
@ 10, 280 XBROWSE oBrw OF oDlg ;
SIZE 300,400 PIXEL NOBORDER
oBrw:SetArray(aData)
oBrw:aCols[1]:cHeader := i18n("Descrizione")
oBrw:aCols[1]:nWidth := 110
oBrw:aCols[2]:cHeader := i18n("X")
oBrw:aCols[2]:nWidth := 110
oBrw:aCols[3]:cHeader := i18n("Y")
oBrw:aCols[3]:nWidth := 110
oBrw:nMarqueeStyle :=MARQSTYLE_HIGHLWIN7 //MARQSTYLE_HIGHLROW
oBrw:nColDividerStyle := LINESTYLE_LIGHTGRAY
oBrw:lColDividerComplete := .t.
oBrw:lRecordSelector := .f.
oBrw:lHScroll := .f.
oBrw:nHeaderHeight := 20
oBrw:nRowHeight := 20
oBrw:SetStyle( 2018 )
oBrw:CreateFromCode()
@ 100,10 BTNBMP oRowAdd PROMPT "Aggiungi riga" of oDlg ;
SIZE 100,22 FLAT NOROUND;
FILENAME ".\bitmaps\aggiungi.png" LEFT ;
ACTION nil //AddRow( oBrw ,@nRows,@nCols,aGet)
@ 100,10 BTNBMP oRowEra PROMPT "Elimina riga" of oDlg ;
SIZE 100,22 FLAT NOROUND;
FILENAME ".\bitmaps\elimina.png" LEFT ;
ACTION nil // DeleteRow( oBrw,@nRows,@nCols,aGet )
oDlg:bResized := <||
local oRect := oDlg:GetCliRect()
oRowAdd:nTop := oBrw:nbottom +10
oRowAdd:nLeft := oRect:nRight - 230
oRowEra:nTop := oBrw:nbottom +10
oRowEra:nLeft := oRect:nRight - 130
RETURN NIL
>
ACTIVATE DIALOG oDlg CENTERED;
ON INIT (Eval(oDlg:bResized))
RELEASE FONT oFont, oBold
RETURN NIL
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
- Silvio.Falconi
- Posts: 7104
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Small RPreview
nageswaragunupudi wrote:This is a small sample program.Please modify the size of the dialog as per your needs.Code: Select all | Expand
#include "fivewin.ch" function Main() local oPrn SetCustomPrintPreview( { |o| DlgPreview( o ) } ) PRINT oPrn PREVIEW oPrn:SetPage( 11 ) PAGE @ 1,1 PRINT TO oPrn IMAGE "..\bitmaps\olga1.jpg" ; SIZE 9,29 CM ALIGN "T" ENDPAGE PAGE @ 1,1 PRINT TO oPrn IMAGE "..\bitmaps\sea.bmp" ; SIZE 9,29 CM ALIGN "T" ENDPAGE ENDPRINT SetCustomPrintPreview( nil ) return nil function DlgPreview( oPrn ) local oDlg, oBar, oImage, nPage := 1 local lBar := Len( oPrn:aMeta ) > 1 DEFINE DIALOG oDlg SIZE 300,400 PIXEL TRUEPIXEL RESIZABLE if lBar DEFINE BUTTONBAR oBar OF oDlg SIZE 32,40 2010 NOBORDER endif @ If( lBar, 60, 20 ),20 XIMAGE oImage SOURCE oPrn:aMeta[ 1 ] SIZE -20,-20 OF oDlg if lBar DEFINE BUTTON OF oBar RESOURCE FWBitmap( "top2" ) ; WHEN nPage > 1 ; ACTION oImage:SetSource( oPrn:aMeta[ nPage := 1 ] ) DEFINE BUTTON OF oBar RESOURCE FwBitmap( "previous2" ) ; WHEN nPage > 1 ; ACTION oImage:SetSource( oPrn:aMeta[ --nPage ] ) DEFINE BUTTON OF oBar RESOURCE FWBitmap( "next2" ) ; WHEN nPage < Len( oPrn:aMeta ) ; ACTION oImage:SetSource( oPrn:aMeta[ ++nPage ] ) DEFINE BUTTON OF oBar RESOURCE FWBitmap( "bottom2" ) ; WHEN nPage < Len( oPrn:aMeta ) ; ACTION ( oImage:SetSource( oPrn:aMeta[ nPage := Len( oPrn:aMeta ) ] ) ) endif ACTIVATE DIALOG oDlg CENTERED return nil
Nages I tested your script
When I go to Small Rpreview I have this
when I size to big the dialog I have this
the image is printed at center , then the image is printed on center or it printed on left ?
problem I not see the buttonbar because I have only a page ok but I wish insert two buttons one for exit and one for print
how I can make ?
If I use
@ nTop + nMargineSuperiore,nLeft + nMargineSinistro PRINT TO oPrn IMAGE cFile ;
SIZE nRight, nBottom CM ALIGN "T"
and I have this result
the image is not printed correctly in the position, I use this function where I convert the measurements from cm to Pixel
Code: Select all | Expand
FUNCTION PrintImage(nTop, nLeft, nRight, nBottom, cFile, nMargineSuperiore, nMargineSinistro, oPrn)
oPrn:Cmtr2Pix(@nTop, @nLeft)
oPrn:Cmtr2Pix(@nBottom, @nRight)
oPrn:SayImage(nTop + nMargineSuperiore, nLeft + nMargineSinistro, cFile, nRight, nBottom)
return nil
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com