POPMENU WITH ACTION ERROR

POPMENU WITH ACTION ERROR

Postby Silvio.Falconi » Mon Nov 12, 2012 9:23 am

When i select an option from menupopup it not call the action why ?


Image




I made this test :

Code: Select all  Expand view


#include "FiveWin.ch"
#include "constant.ch"
#include "Report.ch"
#include "Image.ch"

Function test()
   LOcal  oDlg,oFld

Local aGet[20]

Local cClPassPort:=space(40)


   Local nBottom   := 32
   Local nRight    := 62
   Local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
   Local nHeight := nBottom * DLG_CHARPIX_H
   Local  oFont  := TFont():New( "Lucida Console", 0, 12,, )

   DEFINE DIALOG oDlg        ;
   TITLE "test PopUp Image"   ;
   SIZE nWidth, nHeight  TRANSPARENT PIXEL


 @ 40,   3 FOLDEREX oFld Items    "&Luogo di spesa abituale",;
                                    "&Internet",;
                                    "&Documenti",;
                                    "&Osservazioni";
                              SIZE 240, 160 PIXEL;
                              OF oDlg// COLOR 0, 14215660


   @ 10, 15 SAY "PassaPorto" OF oFld:aDialogs[ 3 ] SIZE 65, 8 PIXEL
   @ 10, 100 SAY "Carta d'Identità" OF oFld:aDialogs[ 3 ] SIZE 65, 8 PIXEL
   @ 10, 160 SAY "Tessera Sanitaria" OF oFld:aDialogs[ 3 ] SIZE 65, 8 PIXEL



      aGet[14] := TImage():New( 2, 2, 60, 60, , If(!empty(cClPassPort),cClPassPort,".\bitmaps\immagine.bmp"), .t.,;
                                    oFld:aDialogs[ 3 ], , , , , ,;
                                     , .t., , , ,  )
      aGet[14]:bRClicked := {|nRow,nCol| PopImage(nRow,nCol,aGet[14],cClPassPort) }

ACTIVATE DIALOG oDlg

retu nil









Function PopImage(nRow,nCol,oControl,cImage)
local oMenu
local cFile
MENU oMenu POPUP 2007

MENUITEM "&Carica un immagine" ;
ACTION (cImage:=PruebaFoto())
MENUITEM "&Mostra l'immagine" ;
ACTION msginfo()
ENDMENU

ACTIVATE POPUP oMenu OF oControl AT nRow, nCol

RETURN cImage



FUNCTION PruebaFoto()

local cFoto

If MsgNoYes( "Desea buscar una fotografia...","Confirme por favor..." )
cFoto := __BuscaFoto( )
? cFoto
End

Return cFoto


FUNCTION __BuscaFoto( )

local cFile

cFile := cGetFile( "BITMAP (*.bmp)| *.bmp|" + ;
"JPG (*.jpg)| *.jpg|" ;
,"Por Favor Seleccione un Archivo de Imágen" )


if ! Empty( cFile ) .and. File( cFile )
Return cFile
End

return ""

 
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
User avatar
Silvio.Falconi
 
Posts: 6774
Joined: Thu Oct 18, 2012 7:17 pm

Re: POPMENU WITH ACTION ERROR

Postby Silvio.Falconi » Tue Nov 13, 2012 10:25 am

Any solution ?
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
User avatar
Silvio.Falconi
 
Posts: 6774
Joined: Thu Oct 18, 2012 7:17 pm

Re: POPMENU WITH ACTION ERROR

Postby Enrico Maria Giordano » Tue Nov 13, 2012 10:59 am

Sorry, but all that I get with your sample is an alert box (using latest FWH).

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8315
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: POPMENU WITH ACTION ERROR

Postby Silvio.Falconi » Tue Nov 13, 2012 11:20 am

??
I see a dialog with a folder ( but I not have the last fwh)


Image
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
User avatar
Silvio.Falconi
 
Posts: 6774
Joined: Thu Oct 18, 2012 7:17 pm

Re: POPMENU WITH ACTION ERROR

Postby Enrico Maria Giordano » Tue Nov 13, 2012 11:50 am

Sorry, it's a problem with latest xHarbour. I'm going to report it. Regarding your problem, try this:

Code: Select all  Expand view
ACTIVATE MENU oMenu AT nRow, nCol OF oControl:oWnd


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8315
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: POPMENU WITH ACTION ERROR

Postby Silvio.Falconi » Tue Nov 13, 2012 2:18 pm

thanks!!!
now run ok!!!
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
User avatar
Silvio.Falconi
 
Posts: 6774
Joined: Thu Oct 18, 2012 7:17 pm

Re: POPMENU WITH ACTION ERROR

Postby Silvio.Falconi » Wed Nov 14, 2012 11:47 am

Dear Emg
the action run ok now but when I call

aGet[14] := TImage():New( 2, 2, 60, 60, , If(!empty(cClPassPort),cClPassPort,".\bitmaps\immagine.bmp"), .t.,;
oFld:aDialogs[ 3 ], , , , , ,;
, .t., , , , )
aGet[14]:bRClicked := {|nRow,nCol| PopImage(nRow,nCol,aGet[14],cClPassPort) }

not send to function the value of cClPassPort changed ( the user select the image before) and the control timage have the lupdate=.t.
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
User avatar
Silvio.Falconi
 
Posts: 6774
Joined: Thu Oct 18, 2012 7:17 pm

Re: POPMENU WITH ACTION ERROR

Postby Enrico Maria Giordano » Wed Nov 14, 2012 1:06 pm

Try

Code: Select all  Expand view
aGet[14]:bRClicked := {|nRow,nCol| cClPassPort := PopImage(nRow,nCol,aGet[14],cClPassPort) }


or

Code: Select all  Expand view
aGet[14]:bRClicked := {|nRow,nCol| PopImage(nRow,nCol,aGet[14],@cClPassPort) }


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8315
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: POPMENU WITH ACTION ERROR

Postby Silvio.Falconi » Wed Nov 14, 2012 1:53 pm

I saw it is strange because it call all bmp files

when the user keep a jpg file it not save it on variable cClPassPort

to show the image I use this simply function

Code: Select all  Expand view

 Function Imagen(oControl,cBmpFile)
          Local nBottom   := 24.2
          Local nRight    := 75
          Local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
          Local nHeight := nBottom * DLG_CHARPIX_H
          Local oDlg

          Local oBmp,cFile
     

         DEFINE DIALOG oDlg        ;
                   TITLE i18n("Immagine")    ;
                    SIZE nWidth, nHeight   PIXEL      ;
                   /* GRADIENT { { 1,CLR_WHITE, LIGHTCYAN } } */   ;
                   FONT oApp:oFont


                     @ 1.2, 0 IMAGE oBmp SIZE  295, 166 OF oDlg SCROLL
                     oBmp:Progress( .f. )



            ACTIVATE DIALOG oDlg CENTERED  ;
                         ON INIT (BarDialogImage(oBmp,oDlg),oBmp:LoadImage( ,cBmpFile ))
                                               return NIL
 


the command on init ...oBmp:LoadImage( ,cBmpFile ) not load the image jpg
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
User avatar
Silvio.Falconi
 
Posts: 6774
Joined: Thu Oct 18, 2012 7:17 pm

Re: POPMENU WITH ACTION ERROR

Postby FranciscoA » Wed Nov 14, 2012 3:30 pm

Silvio, here some modifications on your code.
Code: Select all  Expand view
Function test()
   LOcal  oDlg,oFld
   local aGet[20]
   Local cClPassPort:=space(40)
   Local nBottom   := 32
   Local nRight    := 62
   Local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
   Local nHeight := nBottom * DLG_CHARPIX_H
   Local  oFont  := TFont():New( "Lucida Console", 0, 12,, )

   DEFINE DIALOG oDlg        ;
   TITLE "test PopUp Image"   ;
   SIZE nWidth, nHeight  TRANSPARENT PIXEL

 @ 40,   3 FOLDEREX oFld Items    "&Luogo di spesa abituale",;
                                    "&Internet",;
                                    "&Documenti",;
                                    "&Osservazioni";
                              SIZE 240, 160 PIXEL;
                              OF oDlg// COLOR 0, 14215660

   @ 10, 15 SAY "PassaPorto" OF oFld:aDialogs[ 3 ] SIZE 65, 8 PIXEL
   @ 10, 100 SAY "Carta d'Identità" OF oFld:aDialogs[ 3 ] SIZE 65, 8 PIXEL
   @ 10, 160 SAY "Tessera Sanitaria" OF oFld:aDialogs[ 3 ] SIZE 65, 8 PIXEL

      aGet[14] := TImage():New( 2, 2, 60, 60, , If(!empty(cClPassPort),cClPassPort,".\bitmaps\immagine.bmp"), .t.,;
                                    oFld:aDialogs[ 3 ], , , , , ,;
                                     , .t., , , ,  )
      aGet[14]:bRClicked := {|nRow,nCol| PopImage(nRow,nCol,aGet[14],@cClPassPort) }

ACTIVATE DIALOG oDlg

retu nil


Function PopImage(nRow,nCol,oControl,cImage)
local oMenu
local cFile
MENU oMenu POPUP 2007

MENUITEM "&Carica un immagine" ;
ACTION (cImage:=PruebaFoto(@cImage,oControl))
MENUITEM "&Mostra l'immagine" ;
ACTION msginfo()
ENDMENU

ACTIVATE POPUP oMenu AT nRow, nCol OF oControl:oWnd

RETURN cImage



FUNCTION PruebaFoto(cImage,oControl)

local cFoto

If MsgNoYes( "Desea buscar una fotografia...","Confirme por favor..." )
cFoto := __BuscaFoto(@cImage,oControl)
? cFoto
End

Return cFoto


FUNCTION __BuscaFoto(cImage,oControl)

local cFile

cFile := cGetFile( "BITMAP (*.bmp)| *.bmp|" + ;
"JPG (*.jpg)| *.jpg|" ;
,"Por Favor Seleccione un Archivo de Imágen" )


if ! Empty( cFile ) .and. File( cFile )
   oControl:LoadBmp( cFile )
   oControl:lStretch := .t.
   oControl:Refresh()

   Return cFile
End

return ""
 

Regards
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2110
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: POPMENU WITH ACTION ERROR

Postby Silvio.Falconi » Thu Nov 15, 2012 11:01 am

thanks francisco but I need to call Imagen function to show the image big

I explain on Win xp run ok
Image


on Win seven it not run

if it is a bmp file run ok and I can see the bmp file

if it is a jpg file I cannot see the jpg...strange !!!!
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
User avatar
Silvio.Falconi
 
Posts: 6774
Joined: Thu Oct 18, 2012 7:17 pm

Re: POPMENU WITH ACTION ERROR

Postby FranciscoA » Thu Nov 15, 2012 3:37 pm

Silvio, using your code with some modifications, this works with .bmp or .jpg (compiled with fw1204-xharbour-bwcc582)
Code: Select all  Expand view

Function test()
   LOcal  oDlg,oFld
   local aGet[20]
   Local cClPassPort:=space(40)
   Local nBottom   := 32
   Local nRight    := 62
   Local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
   Local nHeight := nBottom * DLG_CHARPIX_H
   Local  oFont  := TFont():New( "Lucida Console", 0, 12,, )

   DEFINE DIALOG oDlg        ;
   TITLE "test PopUp Image"   ;
   SIZE nWidth, nHeight  TRANSPARENT PIXEL

 @ 40,   3 FOLDEREX oFld Items    "&Luogo di spesa abituale",;
                                    "&Internet",;
                                    "&Documenti",;
                                    "&Osservazioni";
                              SIZE 240, 160 PIXEL;
                              OF oDlg// COLOR 0, 14215660

   @ 10, 15 SAY "PassaPorto" OF oFld:aDialogs[ 3 ] SIZE 65, 8 PIXEL
   @ 10, 100 SAY "Carta d'Identità" OF oFld:aDialogs[ 3 ] SIZE 65, 8 PIXEL
   @ 10, 160 SAY "Tessera Sanitaria" OF oFld:aDialogs[ 3 ] SIZE 65, 8 PIXEL

      aGet[14] := TImage():New( 2, 2, 60, 60, , If(!empty(cClPassPort),cClPassPort,".\bitmaps\immagine.bmp"), .t.,;
                                    oFld:aDialogs[ 3 ], , , , , ,;
                                     , .t., , , ,  )
      aGet[14]:bRClicked := {|nRow,nCol| PopImage(nRow,nCol,aGet[14],@cClPassPort) }

ACTIVATE DIALOG oDlg

retu nil


Function PopImage(nRow,nCol,oControl,cImage)
local oMenu
local cFile
MENU oMenu POPUP 2007

MENUITEM "&Carica un immagine" ;
    ACTION (cImage:=PruebaFoto(@cImage,oControl))
MENUITEM "&Mostra l'immagine" ;
    ACTION Imagen(oControl,@cImage)
ENDMENU

ACTIVATE POPUP oMenu AT nRow, nCol OF oControl:oWnd
RETURN cImage


FUNCTION PruebaFoto(cImage,oControl)
local cFoto

If MsgNoYes( "Desea buscar una fotografia...","Confirme por favor..." )
cFoto := __BuscaFoto(@cImage,oControl)
? cFoto
End
Return cFoto


FUNCTION __BuscaFoto(cImage,oControl)
local cFile

cFile := cGetFile( "BITMAP (*.bmp)| *.bmp|" + ;
"JPG (*.jpg)| *.jpg|" ;
,"Por Favor Seleccione un Archivo de Imágen" )

if ! Empty( cFile ) .and. File( cFile )
   oControl:LoadBmp( cFile )
   oControl:lStretch := .t.
   oControl:Refresh()

   Return cFile
End
return ""

Function Imagen(oControl,cBmpFile)
          Local nBottom   := 24.2
          Local nRight    := 75
          Local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
          Local nHeight := nBottom * DLG_CHARPIX_H
          Local oDlg
          Local oBmp,cFile

         DEFINE DIALOG oDlg        ;
                TITLE i18n("Immagine")    ;
                SIZE nWidth, nHeight PIXEL  

msginfo(cbmpfile)

         @ 1.2, 0 IMAGE oBmp SIZE  295, 166 OF oDlg SCROLL
         oBmp:Progress( .f. )

            ACTIVATE DIALOG oDlg CENTERED  ;
                     ON INIT ( oBmp:LoadImage( ,cBmpFile ) )
                    // ON INIT ( oBmp:LoadBmp(cBmpFile), oBmp:lStretch := .t. )   // This works, also.
return NIL
 

Image
http://dc607.4shared.com/img/pLbOj7gh/s7/Imagen.jpg
Regards
Last edited by FranciscoA on Thu Nov 15, 2012 4:14 pm, edited 4 times in total.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2110
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: POPMENU WITH ACTION ERROR

Postby Silvio.Falconi » Thu Nov 15, 2012 4:01 pm

thanks perhaps I have an error on pc at work ... on my laptop at home run ok
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
User avatar
Silvio.Falconi
 
Posts: 6774
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

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