To Antonio:

To Antonio:

Postby HunterEC » Wed Jun 09, 2010 7:19 am

Antonio:

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
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: To Antonio:

Postby Daniel Garcia-Gil » Wed Jun 09, 2010 4:33 pm

Gustavo...

the image control fill all "client area" dialog, the window events ( MOUSEMOVE, LBUTTONDOWN, LBUTTONUP, etc ) is "captuted" by IMAGE control

controls within a dialog have other dimensions...
you can do: @ 10,0 IMAGE oBmp1 OF oDlg SIZE nImgWidth/2, nImgHeight/2 SCROLL PIXEL

or set the oBmp1 at the end
Code: Select all  Expand view

      @ 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)


      @ 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

      @ 10,0 IMAGE oBmp1 OF oDlg SIZE nImgWidth, nImgHeight SCROLL PIXEL
 
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: To Antonio:

Postby ukoenig » Wed Jun 09, 2010 5:03 pm

Hello Daniel,

I added only one Line in the Sample above without any changes and the Buttons are working fine :

ACTIVATE DIALOG oDlg ON PAINT (oBmp1:LoadBmp(cFile), ;
nBtnIdx := INT(nImgHeight / 3), ;
oBmp1:Move( 10, 0, nImgWidth, nImgHeight, .f. ), ;
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. ))

Best 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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 97 guests