also error with btnbmp SHOWPOPUP

also error with btnbmp SHOWPOPUP

Postby Silvio.Falconi » Fri Mar 29, 2024 2:39 pm

the error sometimes go out

Code: Select all  Expand view  RUN

Error occurred at: 29-03-2024, 15:31:11
   Error description: Error BASE/1004  No exported method: END
   Args:
     [   1] = U  

Stack Calls
===========
   Called from: source\comuni\Pcomuni.prg => END( 0 )
   Called from: Lib\btnbmp.prg => TBTNBMP:SHOWPOPUP( 2183 )
   Called from: source\comuni\Pcomuni.prg => (b)COMUNI( 220 )


on the source I have

Code: Select all  Expand view  RUN
@ 148, 350  BTNBMP aBtnBrow[3] ;
     RESOURCE "GRID_MNU", "", hBmp2, "" ;
      SIZE 15, 13 PIXEL FLAT NOROUND GDIP WHEN lMenu OF oDlg ;
      ACTION ::ShowPopUp( { |oBtn| MenuContextual(oBtn,oBrw,oDbf,cIniUser,cSection,,,oDlg,aBtnBrow[4])  } )



where is the error ? and why is go ot sometimes ?
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: 7066
Joined: Thu Oct 18, 2012 7:17 pm

Re: also error with btnbmp SHOWPOPUP

Postby Antonio Linares » Fri Mar 29, 2024 6:53 pm

Dear Silvio,

> Called from: source\comuni\Pcomuni.prg => END( 0 )

Look for an End() call in source\comuni\Pcomuni.prg
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42117
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: also error with btnbmp SHOWPOPUP

Postby Silvio.Falconi » Sat Mar 30, 2024 2:54 pm

Antonio Linares wrote:Dear Silvio,

> Called from: source\comuni\Pcomuni.prg => END( 0 )

Look for an End() call in source\comuni\Pcomuni.prg


I not understood How it came out

the error is go out when I click on left mouse and show a popup when the mouse is on the xbrowse
Code: Select all  Expand view  RUN
 Error description: Error BASE/1004  Metodo non disponibile: END
   Args:
     [   1] = U  

Stack Calls
===========
   Called from: source\comuni\Pcomuni.prg => END( 0 )
   Called from: Lib\btnbmp.prg => TBTNBMP:SHOWPOPUP( 2183 )
   Called from: source\comuni\Pcomuni.prg => (b)COMUNI( 256 )
   Called from: Lib\btnbmp.prg => TBTNBMP:CLICK( 797 )




on code I have

Code: Select all  Expand view  RUN
   oBrw:bRClicked := {|nRow,nCol| Disp_Menu_Comuni(oDlg,nRow,nCol,oDbf,oBrw,cSection,aBtnBrow[4]) }




on Called from: source\comuni\Pcomuni.prg => (b)COMUNI( 256 ) there is not any command at line 256 as you can see here


Image



on dispMenu_comuni I have a popup menu
Code: Select all  Expand view  RUN


 Static Function Disp_Menu_Comuni(oParent,nRow,nCol,oDbf,oBrw,cSection,oCont)
           local oMenu
           local nFor, nLen
           nLen := Len( oBrw:aCols )
           MENU oMenu POPUP
         if oBrw:IsSelectedRow()
              MENUITEM "Deseleziona la riga corrente" action (oBrw:SelectRow( 0 ),IiF(LEN(oBrw:aSelected)==0,Btnbar(1,oParent:oBar,oParent,oDbf,oBrw),),Refresh_title(oBrw,oParent,oDbf,cSection))
              MENUITEM "Deseleziona tutto"            action (oBrw:SelectRow( 0 ),IiF(LEN(oBrw:aSelected)==0,Btnbar(1,oParent:oBar,oParent,oDbf,oBrw),),Refresh_title(oBrw,oParent,oDbf,cSection))
              MENUITEM "Stampa le righe selezionate"  action PrintBrowse(oParent:cCaption,oBrw,oDbf)
              MENUITEM "Esporta le righe selezionate" action ExportToExcel(oBrw )
           else
              MENUITEM "Seleziona la riga corrente"   action ( oBrw:SelectRow( 2 ) , Btnbar(2,oParent:oBar,oParent,oDbf,oBrw),Refresh_title(oBrw,oParent,oDbf,cSection) )
              MENUITEM "Seleziona tutto"              action (oBrw:SelectRow( 4 ) ,  Btnbar(2,oParent:oBar,oParent,oDbf,oBrw),Refresh_title(oBrw,oParent,oDbf,cSection)   )
              MENUITEM "Stampa"                       action PrintBrowse(oParent:cCaption,oBrw,oDbf)
              MENUITEM "Esporta"                      action ExportToExcel( oBrw )
           endif
           SEPARATOR
           MENUITEM "al primo record  " +space(6)+ CHR(VK_TAB) + "Ctrl+Home";
              MESSAGE "Mostra la lista dal primo record";
              RESOURCE "GRID_TOP";
              ACTION oBrw:KeyDown(VK_HOME, 0)  WHEN oDbf:OrdKeyCount() > 0

            MENUITEM "a pagina prec.  " +space(6)+ CHR(VK_TAB) + "Pag. Sù";
              MESSAGE "Mostra la lista della pagina precedente";
                RESOURCE "GRID_PREVIOUS";
              ACTION oBrw:KeyDown(VK_PRIOR, 0) WHEN oDbf:OrdKeyCount() > 0

            MENUITEM "al precedente record  " +space(6)+ CHR(VK_TAB) + "Indietro";
              MESSAGE "Mostra la lista muovendosi  al record precedente ";
                RESOURCE "GRID_UP";
              ACTION oBrw:KeyDown(VK_UP, 0)    WHEN oDbf:OrdKeyCount() > 0

            MENUITEM "avanti di un record  " + CHR(VK_TAB) +space(6)+ "Avanti";
              MESSAGE "Mostra la lista muovendosi al record avanti";
                RESOURCE "GRID_DOWN";
              ACTION oBrw:KeyDown(VK_DOWN, 0)   WHEN oDbf:OrdKeyCount() > 0

            MENUITEM "a pag. avanti  " +space(6)+ CHR(VK_TAB) + "Pag. Giù";
              MESSAGE "Mostra la lista della pagina avanti";
               RESOURCE "GRID_NEXT";
              ACTION oBrw:KeyDown(VK_NEXT, 0)   WHEN oDbf:OrdKeyCount() > 0

            MENUITEM "all'ultimo record  " +space(6)+ CHR(VK_TAB) + "Ctrl+End";
              MESSAGE "Mostra la lista all'ultimo record";
                RESOURCE "GRID_BOTTOM";
              ACTION oBrw:KeyDown(VK_END, 0)  WHEN oDbf:OrdKeyCount() > 0

            ENDMENU
   ACTIVATE POPUP oMenu OF oParent AT  oBrw:nTop+nRow, oBrw:nLeft+nCol
   RETURN (NIL)
 


Btnbar is the function made bt Cristobal wher are button of the bar and here there is not a call to END
Refresh_title refresh the title of the dialog
PrintBrowse print the dbf with treport
ExportToExcel save the dbf on excel
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: 7066
Joined: Thu Oct 18, 2012 7:17 pm

Re: also error with btnbmp SHOWPOPUP

Postby nageswaragunupudi » Sun Mar 31, 2024 3:26 am

Code: Select all  Expand view  RUN
ACTION ::ShowPopUp( { |oBtn| MenuContextual(oBtn,oBrw,oDbf,cIniUser,cSection,,,oDlg,aBtnBrow[4])  } )


If you use ::ShowPopUp, the function MenuContextual(...) should not return NIL, but should return a PopupMenu object. It looks like this function is returning NIL not a popup menu object. Please check the last line of this function.

That is the exact reason for your error at this line in btnbmp.prg:
Code: Select all  Expand view  RUN

      if ValType( oPopup ) == 'B'
         oWnd:oPopUp:End()  // error here
      endif
 


If the function MenuContextual(..) displays popup menu on its own and then returns NIL, you should use
Code: Select all  Expand view  RUN
ACTION MenuContextual( Self, .... )
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: also error with btnbmp SHOWPOPUP

Postby nageswaragunupudi » Sun Mar 31, 2024 4:28 am

I give here a sample showing 4 ways of displaying PopUpMenu with BtnBmp.
Code: Select all  Expand view  RUN
#include "fivewin.ch"

function Main()

   local oDlg, aBtn[ 4 ]

   DEFINE DIALOG oDlg SIZE 600,300 PIXEL TRUEPIXEL

   @ 40, 40 BTNBMP aBtn[ 1 ] PROMPT "1" SIZE 100,40 PIXEL OF oDlg CENTER ACTION ::ShowPopUp()
   aBtn[ 1 ]:oPopUp := PopupObject()

   @ 40,180 BTNBMP aBtn[ 2 ] PROMPT "2" SIZE 100,40 PIXEL OF oDlg CENTER ;
      ACTION ::ShowPopUp( PopupObject( Self ) )

   @ 40,320 BTNBMP aBtn[ 3 ] PROMPT "3" SIZE 100,40 PIXEL OF oDlg CENTER ;
      ACTION ::ShowPopUp( { | oBtn | PopupObject( oBtn ) } )

   @ 40,460 BTNBMP aBtn[ 4 ] PROMPT "4" SIZE 100,40 PIXEL OF oDlg CENTER ;
      ACTION PoupExec( Self )

   ACTIVATE DIALOG oDlg CENTERED

return nil

function PopupObject()

   local oPop

   MENU oPop POPUP
      MENUITEM "One"
      MENUITEM "Two"
   ENDMENU

return oPop

function PoupExec( oBtn )

   local oPop

   MENU oPop POPUP
      MENUITEM "Three"
      MENUITEM "Four"
   ENDMENU

   ACTIVATE POPUP oPop OF oBtn:oWnd AT oBtn:nBottom, oBtn:nLeft

return nil
 


There are two functions:
1) PopupObject() This function does not show popup menu, but only returns a popup menu object.
Only such functions should be used with ACTION ::ShowPopUp()
2) PopupExec(): This function shows the popmenu itself and returns NIL. This function SHOULD NOT BE used inside ::ShowPopup() and should be used directly as ACTION <function>

In the above sample, if we use the second function in ShowPopup() like this
Code: Select all  Expand view  RUN
::ShowPopUp( { |oBtn| PopUpExec( oBtn ) } )

we get the same runtime error as you got because PopUpExe() returns NIL not a menu object
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: also error with btnbmp SHOWPOPUP

Postby Silvio.Falconi » Sun Mar 31, 2024 9:36 am

Nages,

I have one popup on this codeblock

oBrw:bRClicked := {|nRow,nCol| Disp_Menu_Comuni(oParent,nRow,nCol,oDbf,oBrw,cSection,oCont) .....}

Function Disp_Menu_Comuni(oParent,nRow,nCol,oDbf,oBrw,cSection,oCont)
....
ENDMENU
ACTIVATE POPUP oMenu OF oParent AT oBrw:nTop+nRow, oBrw:nLeft+nCol
RETURN (NIL)



and another on action

Function MenuContextual(oControl,oBrw,oDbf,cIniUser,cSection,lExport,lColConfig,oParent,oCont )
....
ENDMENU
return oMenu



and another with

btnbmp ocolonne ....
ACTION oColonne:ShowPopUp( { |oBtn,nRow,nCol| ColonneMenu(oBtn,oBrw,oDbf,nRow,ncol,oDlg,cSection,cIniUser) } )

with the return
ENDMENU
return oMenu



I saw your sample and not understood where is the error on my source
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: 7066
Joined: Thu Oct 18, 2012 7:17 pm

Re: also error with btnbmp SHOWPOPUP

Postby Silvio.Falconi » Sun Mar 31, 2024 8:35 pm

Nages

I made a small test with all my 3 buttons

I use customer.dbf

Image


modify the sample test xbrwin7.prg

I have error when press btn2

the test
Code: Select all  Expand view  RUN


// Using Windows 7 row selection colors in xbrowse

#include 'fivewin.ch'
#include 'xbrowse.ch'

 request dbfcdx


function Main()

   local oDlg, oBrw, oFont

   local oBtn1,oBtn2
   local oDbf

  oDbf:= TCustomer():New()
   oDbf:SetOrder(1)
   oDbf:gotop()

  // USE CUSTOMER ALIAS CUST

   DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -14

   DEFINE DIALOG oDlg SIZE 640,440 PIXEL ;
      FONT oFont TITLE 'XBrowse Gradient Rows'

   @ 30, 10 XBROWSE oBrw OF oDlg SIZE 300, 200 PIXEL ;
      AUTOCOLS DATASOURCE oDbf NOBORDER

   oBrw:nMarqueeStyle    = MARQSTYLE_HIGHLWIN7
   oBrw:CreateFromCode()



 oBrw:bRClicked := {|nRow,nCol| Display_Menu(oDlg,nRow,nCol,oDbf,oBrw) }



 @ 8, oBrw:nWidth-200 BTNBMP oBtn1;
                FLAT  SIZE 60, 12 OF oDlg   PIXEL ;
                PROMPT "btn1" RIGHT ;
                COLOR  CLR_BLACK,nRgb(238,236,219) ;
                BITMAP "SOR_TDW" NOROUND ;
                ACTION  ::ShowPopUp( { | oBtn,nRow,nCol | Menu_btn1(oBtn,oBrw,oDbf,nRow,ncol,oDlg) } )





  @ 8, oBrw:nWidth-100 BTNBMP oBtn2;
                FLAT  SIZE 60, 12 OF oDlg   PIXEL ;
                PROMPT "btn2" RIGHT ;
                COLOR  CLR_BLACK,nRgb(238,236,219) ;
                BITMAP "SOR_TDW" NOROUND ;
                 ACTION ::ShowPopUp( { |oBtn| MenuContextual(oBtn,oBrw,oDbf,oDlg)  } )



   ACTIVATE DIALOG oDlg CENTERED

   RELEASE FONT oFont

return nil

//---------------------------------------------------------------------------------//
Function Display_Menu(oParent,nRow,nCol,oDbf,oBrw)
local oMenu

 MENU oMenu POPUP
 MENUITEM "al primo record  " +space(6)+ CHR(VK_TAB) + "Ctrl+Home";
              MESSAGE "Mostra la lista dal primo record";
              RESOURCE "GRID_TOP";
              ACTION oBrw:KeyDown(VK_HOME, 0)  WHEN oDbf:OrdKeyCount() > 0

            MENUITEM "a pagina prec.  " +space(6)+ CHR(VK_TAB) + "Pag. Sù";
              MESSAGE "Mostra la lista della pagina precedente";
                RESOURCE "GRID_PREVIOUS";
              ACTION oBrw:KeyDown(VK_PRIOR, 0) WHEN oDbf:OrdKeyCount() > 0

            MENUITEM "al precedente record  " +space(6)+ CHR(VK_TAB) + "Indietro";
              MESSAGE "Mostra la lista muovendosi  al record precedente ";
                RESOURCE "GRID_UP";
              ACTION oBrw:KeyDown(VK_UP, 0)    WHEN oDbf:OrdKeyCount() > 0

            MENUITEM "avanti di un record  " + CHR(VK_TAB) +space(6)+ "Avanti";
              MESSAGE "Mostra la lista muovendosi al record avanti";
                RESOURCE "GRID_DOWN";
              ACTION oBrw:KeyDown(VK_DOWN, 0)   WHEN oDbf:OrdKeyCount() > 0

            MENUITEM "a pag. avanti  " +space(6)+ CHR(VK_TAB) + "Pag. Giù";
              MESSAGE "Mostra la lista della pagina avanti";
               RESOURCE "GRID_NEXT";
              ACTION oBrw:KeyDown(VK_NEXT, 0)   WHEN oDbf:OrdKeyCount() > 0

            MENUITEM "all'ultimo record  " +space(6)+ CHR(VK_TAB) + "Ctrl+End";
              MESSAGE "Mostra la lista all'ultimo record";
                RESOURCE "GRID_BOTTOM";
              ACTION oBrw:KeyDown(VK_END, 0)  WHEN oDbf:OrdKeyCount() > 0

            ENDMENU
   ACTIVATE POPUP oMenu OF oParent AT  oBrw:nTop+nRow, oBrw:nLeft+nCol
   RETURN (NIL)
//---------------------------------------------------------------------------------//

Function Menu_btn1(oBtn,oBrw,oDbf,nRow,ncol,oDlg)
local oPop

    local oCol, cPrompt
    local nFor, nLen
    local cPrvGrp  := ""
    local oGrpMenu
    local lChecked

    nLen := Len( oBrw:aCols )

 MENU oPop POPUP

 //-----------------------------------init-from xbrowse--------------------//
   for nFor := 1 to nLen
         oCol := oBrw:aCols[ nFor ]
         if !( IfNil( oCol:cGrpHdr, "" ) == cPrvGrp )
            if ! Empty( cPrvGrp )
               ENDMENU
               oGrpMenu := nil
            endif
            if ! Empty( oCol:cGrpHdr )
               MENUITEM oCol:cGrpHdr BOLD
               MENU
                  MENUITEM oGrpMenu PROMPT oCol:cGrpHdr BOLD ;
                     ACTION ( lChecked := oMenuItem:lChecked, ;
                        AEval( oMenuItem:Cargo, ;
                        { |o| If( lChecked, o:Hide(), o:Show() ) } ) )
                  oGrpMenu:Cargo := {}
                  SEPARATOR
            endif
            cPrvGrp  := IfNil( oCol:cGrpHdr, "" )
         endif

         MenuAddItem( If( Empty( oCol:cHeader ), "Col-" + cValToChar( nFor ), oCol:cHeader ), ;
            nil, !oCol:lHide, ;
            ( Len(oBrw:aDisplay) != 1 .or. ocol:nPos != 1 ), ;
            { |o| If( o:Cargo:lHide, o:Cargo:Show(), o:Cargo:Hide() ) } ):Cargo := oCol

         if oGrpMenu != nil
            AAdd( oGrpMenu:Cargo, oCol )
            if !oCol:lHide
               oGrpMenu:lChecked := .t.
            endif
         endif

      next
 //------------------------------------end from xbrowse--------------------//


SEPARATOR

     MenuItem "Posizione Colonne" action nil
 ENDMENU

     return oPop
//------------------------------------------------------------------------//



 Function MenuContextual(oBtn,oBrw,oDbf,oDlg)

    local oMenu,oCol, cPrompt
    local nFor, nLen
    local cPrvGrp  := ""
    local oGrpMenu
    local lChecked

     nLen := Len( oBrw:aCols )

     MENU oMenu POPUP

      if oBrw:IsSelectedRow()
              MENUITEM "Deseleziona la riga corrente" action (oBrw:SelectRow( 0 ))
              MENUITEM "Deseleziona tutto"            action (oBrw:SelectRow( 0 ))
              MENUITEM "Stampa le righe selezionate"  action NIL
              MENUITEM "Esporta le righe selezionate" action NIL
           else
              MENUITEM "Seleziona la riga corrente"   action ( oBrw:SelectRow( 2 )  )
              MENUITEM "Seleziona tutto"              action (oBrw:SelectRow( 4 )   )
              MENUITEM "Stampa"                       action NIL
           If lExport
              MENUITEM "Esporta"                      action NIL
           Endif
        endif


        MENUITEM "Colonne"
            MENU
         //--------------------------------------------------------//
         for nFor := 1 to nLen
         oCol := oBrw:aCols[ nFor ]
         if !( IfNil( oCol:cGrpHdr, "" ) == cPrvGrp )
            if ! Empty( cPrvGrp )
               ENDMENU
               oGrpMenu := nil
            endif
            if ! Empty( oCol:cGrpHdr )
               MENUITEM oCol:cGrpHdr BOLD
               MENU
                  MENUITEM oGrpMenu PROMPT oCol:cGrpHdr BOLD ;
                     ACTION ( lChecked := oMenuItem:lChecked, ;
                        AEval( oMenuItem:Cargo, ;
                        { |o| If( lChecked, o:Hide(), o:Show() ) } ) )
                  oGrpMenu:Cargo := {}
                  SEPARATOR
            endif
            cPrvGrp  := IfNil( oCol:cGrpHdr, "" )
         endif

         MenuAddItem( If( Empty( oCol:cHeader ), "Col-" + cValToChar( nFor ), oCol:cHeader ), ;
            nil, !oCol:lHide, ;
            ( Len(oBrw:aDisplay) != 1 .or. ocol:nPos != 1 ), ;
            { |o| If( o:Cargo:lHide, o:Cargo:Show(), o:Cargo:Hide() ) } ):Cargo := oCol

         if oGrpMenu != nil
            AAdd( oGrpMenu:Cargo, oCol )
            if !oCol:lHide
               oGrpMenu:lChecked := .t.
            endif
         endif

      next

      SEPARATOR

      MenuItem "Posizione Colonne" ACTION NIL //

      //--------------------------------------------------------//
    ENDMENU



         ENDMENU
     return oMenu


































CLASS TXData from TDataBase
       DATA cDbfPath INIT cFilePath( ExeName() ) + ".\"
    ENDCLASS

    CLASS TCustomer from TXData
       METHOD New()
    ENDCLASS
    METHOD New( lShared ) CLASS TCustomer
       Default lShared := .t.
       ::Super:Open(,::cDbfPath + "
Customer" ,"DBFCDX", lShared)
       if ::Used()
          ::setOrder(1)
          ::GoTop()
       endif
    return Self

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: 7066
Joined: Thu Oct 18, 2012 7:17 pm

Re: also error with btnbmp SHOWPOPUP

Postby Silvio.Falconi » Mon Apr 01, 2024 10:33 pm

Nages,
sorry
perhaps I understood , now it seem not make error


@ 148, 350 BTNBMP aBtnBrow[3] ;
RESOURCE "GRID_MNU", "", hBmp2, "" ;
SIZE 15, 13 PIXEL FLAT NOROUND GDIP WHEN lMenu OF oDlg ;
ACTION ::ShowPopUp( Contextual_Menu( Self,oBrw,oDbf,cIniUser,cSection,oDlg,aBtnBrow[4] ) )


Function Contextual_Menu( oBtn,oBrw,oDbf,cIniUser,cSection,oParent,oCont,lExport,lColConfig )
....
MENU oMenu POPUP

..

ENDMENU
return oMenu
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: 7066
Joined: Thu Oct 18, 2012 7:17 pm

Re: also error with btnbmp SHOWPOPUP

Postby Giovany Vecchi » Tue Apr 02, 2024 1:07 am

Use directly in the xBrowse column

Code: Select all  Expand view  RUN
lc_oColDtImg := ::oBrw2161_AgentesDocImgs:AddCol()
With Object lc_oColDtImg
    :bStrData         := {||::oDsTmp_AgenteDocsImgs:N_AGE_DOCIMGS_dImagemData}
    :cHeader          := "Dt. Imagem "
    //:cToolTip         := ""
    :nWidth           := 118
    :nDataStrAlign    := AL_RIGHT
    :nHeadStrAlign    := AL_RIGHT
    :nEditType        := EDIT_BUTTON
    :AddResource("B16_SETABAIXO") //Bmp arrow
    :nBtnBmp          := 1
    :nBtnWidth        := 20
    :bEditBlock       := <|nHandle,nHWnd,oSelfBtn|
        Local _oMenuFotos, _aCursorPosicao := {20,12} //Linha, Coluna
        Local _lTmp := .F., _aMenuItem := Array(4)
     
        MENU _oMenuFotos POPUP 2015
     
            If ::oDsTmp_AgenteDocsImgs:N_AGE_DOCIMGS_nSeqAuto > 0
                MENUITEM _aMenuItem[1] Prompt "Marcar imagem do documento para exclusão" OF _oMenuFotos Resource "B16M_DELETE"  
                    _aMenuItem[1]:bAction := <||
                        If MsgNoYes("O registro da imagem do documento será marcada para exclusão após "+;
                                        "a confirmação do procedimento."+CRLF+CRLF+;
                                        "Deseja marcar a imagem do documento para exclusão ?",;
                                        "Atenção, Responda.")
                            ::oDsTmp_AgenteDocsImgs:VarPut("nFlagProcess",4)
                        EndIf
                        ::oBrw2161_AgentesDocImgs:Refresh()
                        ::oBrw2161_AgentesDocImgs:SetFocus()
                        Return Nil  
                    > //cEnd
               
                If !::oDsTmp_AgenteDocsImgs:N_AGE_DOCIMGS_lCCN_Enviar
                    MENUITEM _aMenuItem[2] Prompt "Colocar na fila para envio ao CCN" OF _oMenuFotos Resource "B16M_AgenteFotoUp"
                        _aMenuItem[2]:bAction := <||
                            If MsgYesNo("Deseja incluir na fila para a imagem do documento ser enviada para o CCN ?",;
                                            "Atenção, Responda.")
                                ::oDsTmp_AgenteDocsImgs:VarPut("N_AGE_DOCIMGS_lCCN_Enviar",.T.)
                            EndIf
                            ::oBrw2161_AgentesDocImgs:Refresh()
                            ::oBrw2161_AgentesDocImgs:SetFocus()
                            Return Nil  
                        > //cEnd
                else
                    MENUITEM _aMenuItem[3] Prompt "Tirar da fila de envio ao CCN" OF _oMenuFotos Resource "B16M_BORRACHAREMOVE"  
                        _aMenuItem[3]:bAction := <||
                            If MsgYesNo("Deseja desmarcar o envio da imagem do documento para o CCN ?",;
                                            "Atenção, Responda.")
                                ::oDsTmp_AgenteDocsImgs:VarPut("N_AGE_DOCIMGS_lCCN_Enviar",.F.)
                            EndIf
                            ::oBrw2161_AgentesDocImgs:Refresh()
                            ::oBrw2161_AgentesDocImgs:SetFocus()
                            Return Nil  
                        > //cEnd

                EndIf
                   
            EndIf

            If ::oDsTmp_AgenteDocsImgs:N_AGE_DOCIMGS_nSeqAuto == -1
                MENUITEM _aMenuItem[2] Prompt "Excluir a foto recém incluída" OF _oMenuFotos Resource "B16M_BORRACHA"
                    _aMenuItem[2]:bAction := <||
                        If MsgYesNo("Deseja excluir a foto recém incluída ?",;
                                        "Atenção, Responda.")
                            ::oDsTmp_AgenteDocsImgs:Delete()
                            ::oBrw2161_AgentesDocImgs:GoUp()
                        EndIf
                        ::oBrw2161_AgentesDocImgs:Refresh()
                        Eval(::oBrw2161_AgentesDocImgs:bChange)
                        ::oBrw2161_AgentesDocImgs:SetFocus()
                        Return Nil  
                    > //cEnd
            EndIf

        ENDMENU  
        ACTIVATE POPUP _oMenuFotos AT _aCursorPosicao[1], _aCursorPosicao[2] ;
            OF oSelfBtn:oBtnElip
   
        Return Nil
    > //cEnd
End With      
 
User avatar
Giovany Vecchi
 
Posts: 223
Joined: Mon Jun 05, 2006 9:39 pm
Location: Brasil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 49 guests