but this applies to a model,
Is it possible to save an x, y coordinate by pressing on the screen in an x, y point with the mouse inside an image?
the coordinates must be saved so that a pixel can be printed at the same coordinate
I would like to have a procedure where the user can easily enter the coordinates by pressing the various points with the mouse and save them in an archive for example
Desc: = Number1 x = 0.8 y = 2.65
and then the procedure will print all the saved points
I made a small test
- Code: Select all Expand view RUN
#include "fivewin.ch"
#include "constant.ch"
Function Print_Setup_pixel()
local oDlg,ofolder,oFont,oBold
local oBtnok,oBtnClose,ctitle:="Setup di Stampa"
local aprompts:={"Numeri","Ruote","Simbolotto","Importi","Estratto","Giocate" }
local nBottom := 33
local nRight := 80
local nWidth := Max( nRight * DLG_CHARPIX_W, 180 )
local nHeight := nBottom * DLG_CHARPIX_H
local cImage := "002.jpg"
local oImage
local aData :={{"number 1",4.2,21.4},;
{"number 2",5.2,21.4}}
local nMargine_X:= 590
local nMargine_Y:= 200
local oBrw
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
TiTLE ctitle
@ -60,0 XIMAGE oImage ;
FILENAME cImage ;
NOBORDER ;
SIZE nMargine_Y,nMargine_X ;
OF oDlg ;
UPDATE
oImage:bRClicked := { | nRow, nCol, nFlags | Msginfo(Str(nRow),Str(ncol)) }
oImage:ltransparent:=.t.
oImage:nUserControl :=0
@ 0, 210 XBROWSE oBrw SIZE 395,330 PIXEL OF oDlg ;
DATASOURCE aData AUTOCOLS CELL LINES NOBORDER FASTEDIT
SetupBrowseMatrix(oBrw)
oBrw:bchange:= {||ShowPixel(oBrw,oImage) }
oBrw:CreateFromCode()
@ 100,10 BUTTON oBtnClose PROMPT "Close" of oDlg SIZE 80,22 ACTION oDlg:End()
oDlg:bResized := <||
local oRect := oDlg:GetCliRect()
oBtnClose:nLeft := oRect:nRight - 100
oBtnClose:nTop := oRect:nBottom - 45
RETURN NIL
>
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT (oDlg:resize() )
RELEASE FONT oFont, oBold
RETURN nil
static function SetupBrowseMatrix( oBrw )
WITH OBJECT oBrw
// :RecSelShowKeyNo()
:lDrawBorder := .t.
:lHscroll := .f.
:lVscroll := .t.
:l2007 := .f.
:l2015 := .f.
:lAllowRowSizing := .f.
:lAllowColSwapping := .f.
:lAllowColHiding := .f.
// NEW
:lAllowSizings := .f.
:lAutoSaves := .t.
:nRowDividerStyle := LINESTYLE_LIGHTGRAY
:nColDividerStyle := LINESTYLE_LIGHTGRAY
:bRecSelHeader := { || " " }
:SetStyle( 2018 )
// :CreateFromCode()
END
return nil
//------------------------------------------------//
Function ShowPixel(oBrw,oImage)
local aData := oBrw:aArrayData
local nTop := oBrw:aArrayData[oBrw:nat][2]
local nLeft := oBrw:aArrayData[oBrw:nat][3]
local oBrush
local aRect := { nTop, nLeft , 5 , 5 }
DEFINE BRUSH oBrush COLOR CLR_RED
FillRect( oImage:hDC, aRect, oBrush )
return nil
//----------------------------------------------------
I tried to insert the possibility to show a red pixel when change the xbrowse but not run ok
But I not understood the measure save the coordinates on Video and How I must print on printer on the same x,y