I do not understand why in the following code the buttons does not work with the mouse even though the keyboard shortcuts works. Also on some images when I click on them some buttons disappear (2nd button & checkbox). What I'm trying to do is a little program that displays an image from the bottom right corner upwards. The image will always be anchored to the bottom right part of the screen. Thank you. I'm using FW 10.05. Here's the code:
- Code: Select all Expand view
- #include "Common.ch"
#include "Fivewin.ch"
#include "Image.ch"
//----------------------------------------------------------------------------//
FUNCTION Main (cFile, cTitle)
LOCAL oTextFont, oBmp1, nImgHeight, nImgWidth, oDlg, oBrush1, oSay1, ;
oButton1, oButton2, oCbx, nBtnIdx
DEFAULT cFile TO "Tempsig.jpg"
DEFAULT cTitle TO "Default Title"
oTextFont := TFont():New("Arial",0,-12,.F.,.T.,0,0,0,.T. )
IF FILE (cFile) // Ask if Image exists ( no Function )
DEFINE IMAGE oBmp1 FILENAME cFile
nImgHeight := oBmp1:nHeight()
nImgWidth := oBmp1:nWidth()
DEFINE DIALOG oDlg TITLE cTitle
oDlg:nTop := GetSysMetrics(1) - nImgHeight - 85
oDlg:nLeft := GetSysMetrics(0) - nImgWidth - 100
oDlg:nBottom := GetSysMetrics(1) - 65
oDlg:nRight := GetSysMetrics(0) - 10
oCbx := oBmp1:lStretch
@ 0,0 SAY oSay1 VAR cTitle OF oDlg CENTERED PIXEL ;
SIZE INT(nImgWidth / 2) + IIF((nImgWidth % 2) > 0, 1, 0), 10 ;
COLOR nRGB(255,255,255), nRGB(0,0,255)
@ 10,0 IMAGE oBmp1 OF oDlg SIZE nImgWidth, nImgHeight SCROLL PIXEL
@ 20,255 BUTTON oButton1 PROMPT "&Imprimir" SIZE 30,10 OF oDlg PIXEL ;
ACTION PrintImage( oBmp1)
@ 55,255 BUTTON oButton2 PROMPT "&Terminar" SIZE 30,10 OF oDlg ;
PIXEL ACTION oDlg:End()
@ 110,255 CHECKBOX oCbx VAR oBmp1:lStretch PROMPT "&Agrandar" SIZE 40, 10 OF oDlg ;
PIXEL ON CHANGE ( oBmp1:ScrollAdjust(), oBmp1:Refresh() ) FONT oTextFont
ACTIVATE DIALOG oDlg ON PAINT (oBmp1:LoadBmp(cFile), ;
nBtnIdx := INT(nImgHeight / 3), ;
oButton1:Move( 30, oDlg:nWidth - 75, .f. ), ; // Move Button1
oButton2:Move( (nBtnIdx * 2) - 30, oDlg:nWidth - 75, .f. ), ; // Move Button2 )
oCbx:Move( (nBtnIdx * 3) - 10, oDlg:nWidth - 85, .f. ))
ELSE
MsgInfo("Esta Imagen No Existe: " + cFile)
ENDIF
oTextFont:End()
RETURN NIL
// EOF: Main
// --------------------------
FUNCTION PrintImage( oImage )
LOCAL oPrn
PRINT oPrn NAME "Image Printing" PREVIEW
PAGE
oPrn:SayImage( 0, 0, oImage )
ENDPAGE
ENDPRINT
RETURN NIL
* EOF: PrintImage