xBrowse - No entiendo el error (Mr. Rao)

xBrowse - No entiendo el error (Mr. Rao)

Postby MarioG » Thu May 28, 2015 3:40 pm

Estimados;
Tengo el siguiente código donde pretendo usar SetCheck()

Code: Select all  Expand view
 REDEFINE XBROWSE oBrwPer ID 300 OF oDlg ;
           COLUMNS "DESCRIP",  "PERMISO"  ;
           HEADERS "Permisos", "Chk"      ;
           ALIAS Alias()

   WITH Object oBrwPer
      :nMarqueeStyle      := MARQSTYLE_DOTEDCELL      // barra señaladora
      :nColDividerStyle   := LINESTYLE_BLACK          // Linea Tipo
      :lColDividerComplete:= TRUE                     // Linea de columna hasta final de Brw
      :nStretchCol        := STRETCHCOL_LAST          // Ajustar ultima col, al margen derecho
      :l2007              := TRUE
      :lAllowColHiding    := FALSE                    // Anular menu pop Ocultar/Mostrar columna
      :nRowHeight         := 38
      :nMoveType          := MOVE_DOWN
      :lVScroll           := TRUE
      :nColSel:= 2

      :CreateFromCode()
      :SetBackGround( aGrad )

      :bGotFocus:= {|| ::oDBPermi:SetFocus() }
   END
   // Columnas
   WITH OBJECT oBrwPer:Permisos
      :nWidth:= 320
      :bPaintText:= { |oCol, hDC, cText, aCoord| ::DrawCol( oCol, hDC, cText, aCoord ) }
   END
   WITH OBJECT oBrwPer:Chk
      :nWidth:= 50
      :nHeadStrAlign:= :nDataStrAlign:= AL_CENTER

      :SetCheck( {"bmp_Ok", ""}, {|o, v| ::oDBPermi:Load(), ;
                                         ::oDBPermi:Permiso:= v, ;
                                         ::oDBPermi:Save() } )
   END
 

El problema se dá con SetCheck(), ya que si lo comento, el browse se muestra sin problemas.
Bajo esta condición se produce el siguiente error:

    Descripción de Error generado:
    ___________________________________________________

    Error BASE/1004 Class: 'LOGICAL' has no exported method: EVAL
    Args:
    [ 1] = L .F.


    Llamadas al Stack:
    ___________________________________________________

    Llamado desde: EVAL(0)
    Llamado desde: .\source\classes\XBROWSE.PRG TXBRWCOLUMN:PAINTCELL(9609)
    Llamado desde: .\source\classes\XBROWSE.PRG TXBRWCOLUMN:PAINTDATA(9561)
    Llamado desde: .\source\classes\XBROWSE.PRG TXBROWSE:PAINT(1434)
    Llamado desde: .\source\classes\XBROWSE.PRG TXBROWSE:DISPLAY(1253)
    Llamado desde: D:\MIHARB~1\Mifwh\Sources\control.prg TCONTROL:HANDLEEVENT(1666)
    Llamado desde: .\source\classes\XBROWSE.PRG TXBROWSE:HANDLEEVENT(11632)
    Llamado desde: .\source\classes\WINDOW.PRG _FWH(3153)
    Llamado desde: DIALOGBOX(0)
    Llamado desde: .\source\classes\DIALOG.PRG TDIALOG:ACTIVATE(270)
    Llamado desde: D:\MixHarb\Temege\Sources\TCtrlAcc.prg TCTRLACC:CREAUSUARIOS(317)
    Llamado desde: D:\MixHarb\Temege\Sources\mgCfgSys.prg (b)TCFGSYS:CFGSYS(428)
    Llamado desde: .\source\classes\TGET.PRG TGET:LVALID(1184)
    Llamado desde: D:\MIHARB~1\Mifwh\Sources\control.prg TGET:FWLOSTFOCUS(1110)
    Llamado desde: D:\MIHARB~1\Mifwh\Sources\control.prg TCONTROL:HANDLEEVENT(1675)
    Llamado desde: .\source\classes\TGET.PRG TGET:HANDLEEVENT(579)
    Llamado desde: .\source\classes\WINDOW.PRG _FWH(3153)
    Llamado desde: SYSREFRESH(0)
    Llamado desde: .\source\classes\BTNBMP.PRG TBTNBMP:LBUTTONDOWN(584)
    Llamado desde: D:\MIHARB~1\Mifwh\Sources\control.prg TCONTROL:HANDLEEVENT(1687)
    Llamado desde: .\source\classes\BTNBMP.PRG TBTNBMP:HANDLEEVENT(1408)
    Llamado desde: .\source\classes\WINDOW.PRG _FWH(3153)
    Llamado desde: DIALOGBOX(0)
    Llamado desde: .\source\classes\DIALOG.PRG TDIALOG:ACTIVATE(270)
    Llamado desde: D:\MixHarb\Temege\Sources\mgCfgSys.prg TCFGSYS:CFGSYS(467)
    Llamado desde: D:\Fuen32\SiGeCo2\CA32\Source\CA_MAIN.PRG (b)BUILDMENU(167)
    Llamado desde: .\source\classes\MENU.PRG TMENU:COMMAND(461)
    Llamado desde: .\source\classes\WINDOW.PRG TWINDOW:COMMAND(1027)
    Llamado desde: TWINDOW:HANDLEEVENT(0)
    Llamado desde: .\source\classes\WINDOW.PRG _FWH(3153)
    Llamado desde: WINRUN(0)
    Llamado desde: .\source\classes\WINDOW.PRG TWINDOW:ACTIVATE(980)
    Llamado desde: D:\Fuen32\SiGeCo2\CA32\Source\CA_MAIN.PRG CA_MAIN(88)
Que es lo que no veo en este error, para corregirlo?
Last edited by MarioG on Fri May 29, 2015 9:37 am, edited 1 time in total.
Resistencia - "Ciudad de las Esculturas"
Chaco - Argentina
User avatar
MarioG
 
Posts: 1380
Joined: Fri Oct 14, 2005 1:28 pm
Location: Resistencia - Chaco - AR

Re: xBrowse - No entiendo el error

Postby karinha » Thu May 28, 2015 4:06 pm

Intenta asi:

Code: Select all  Expand view

   :SetCheck( { "bmp_Ok", "  " }, {|o, v| ( ::oDBPermi:Load(), ::oDBPermi:Permiso := v, ::oDBPermi:Save() ) } )
 


Salu2

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7316
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: xBrowse - No entiendo el error

Postby MarioG » Thu May 28, 2015 6:45 pm

Karina; gracias por responder
NO es la solución, el error se repite
Resistencia - "Ciudad de las Esculturas"
Chaco - Argentina
User avatar
MarioG
 
Posts: 1380
Joined: Fri Oct 14, 2005 1:28 pm
Location: Resistencia - Chaco - AR

Re: xBrowse - No entiendo el error

Postby karinha » Thu May 28, 2015 7:29 pm

Miara el method PaintCell()

Se está asi:

Code: Select all  Expand view

cData    := AllTrim( IfNil( ::StrData, "" ) )
 


Cambia para:

Code: Select all  Expand view

 cData    := AllTrim( cValToChar( IfNil( ::StrData, "" ) ) )
 


salu2
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7316
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: xBrowse - No entiendo el error

Postby karinha » Thu May 28, 2015 7:33 pm

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7316
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: xBrowse - No entiendo el error

Postby MarioG » Thu May 28, 2015 9:35 pm

karinha wrote:Miara el method PaintCell()

Se está asi:

Code: Select all  Expand view

cData    := AllTrim( IfNil( ::StrData, "" ) )
 


Cambia para:

Code: Select all  Expand view

 cData    := AllTrim( cValToChar( IfNil( ::StrData, "" ) ) )
 


salu2

Karinha: Gracias por tu tiempo
Prefiero no tocar los fuentes. Uso FWH 12.04. Está corregido en versiones posteriores?
He leido el enlace del siguiente post; no es mi caso:
Code: Select all  Expand view
...
   WITH OBJECT oBrwPer:Chk
      :nWidth:= 50
      :nHeadStrAlign:= :nDataStrAlign:= AL_CENTER

      :SetCheck( { "bmp_Ok", " " }, {|o, v| ( ::oDBPermi:Load(), ::oDBPermi:Permiso := v, ::oDBPermi:Save() ) } )
   END
   oBrwPer:CreateFromCode()
   oBrwPer:SetFocus()
 

En otra app estoy usando esta forma de llamar a SetCheck(), con la salvedad de que el browse es de array.
Es un bugs en la version 12.04?
Resistencia - "Ciudad de las Esculturas"
Chaco - Argentina
User avatar
MarioG
 
Posts: 1380
Joined: Fri Oct 14, 2005 1:28 pm
Location: Resistencia - Chaco - AR

Re: xBrowse - No entiendo el error (Mr. Rao)

Postby MarioG » Fri May 29, 2015 9:38 am

Mr. Rao
Can you see this?. It's Karinha's solution the unique way

many thanks
Resistencia - "Ciudad de las Esculturas"
Chaco - Argentina
User avatar
MarioG
 
Posts: 1380
Joined: Fri Oct 14, 2005 1:28 pm
Location: Resistencia - Chaco - AR

Re: xBrowse - No entiendo el error (Mr. Rao)

Postby karinha » Fri May 29, 2015 12:44 pm

En FWH13.06 esta asi. Compara con tu version.

Code: Select all  Expand view

METHOD PaintCell( nRow, nCol, nHeight, lHighLite, lSelected, nOrder, nPaintRow ) CLASS TXBrwColumn

   local hDC, oBrush, hBrush, nOldColor, hBmp
   local oBrush1, oBrush2, hBrush1, hBrush2, aColor2, nWidth1
   local oFont
   local aColors, aBitmap, aBmpPal
   local cData, nTxtHeight, aRect
   local nWidth, nTop, nBottom, nBmpRow, nBmpCol, nBmpNo, nButtonRow, nButtonCol,nBtnWidth,;
         nRectWidth, nRectCol, nStyle, nType, nIndent, nBtnBmp, nFontHeight
   local lTransparent := .f.
   local lStretch     := .f.
   local lBrush       := .f.
   local cImagen, nBmpW, nBmpH

   DEFAULT lHighLite := .f.,;
           lSelected := .f.,;
           nOrder    := 0

   nBtnBmp := 0

   if ( ::oEditGet != nil .and. nPaintRow == ::oBrw:nRowSel ) .or. ::oEditLbx != nil .or. ::oBrw:nLen == 0
      return nil
   endif

   if nCol != nil
      ::nDisplayCol := nCol
   else
      nCol := ::nDisplayCol
   endif

   if ValType( ::bStrData ) == 'B'
      cData := Eval( ::bStrData, nil, Self )
      if ValType( cData ) != 'C'
         cData := cValToChar( cData )
      endif
      if ! Empty( ::nDataStrAlign )
         cData := AllTrim( cData )
      endif
      if isrtf( cData )
         cData := "<RichText>"
      elseif isGtf( cData )
         cData := GtfToTxt( cData )
      endif
   else
      cData := ""
   endif

   if ::bBmpData != nil
      nBmpNo := Eval( ::bBmpData, ::Value() )
   else
      nBmpNo := 0
   endif

   if lHighLite
      if ::oBrw:hWnd == GetFocus()
         if lSelected
            if nOrder == ::oBrw:nColSel
               aColors  := Eval( ::bClrSelFocus )  // Eval( ::oBrw:bClrSelFocus )
            else
               aColors := Eval( If( ::oBrw:bClrRowFocus != nil, ::oBrw:bClrRowFocus, ::bClrSelFocus ) )
            endif
          else
            aColors := Eval( If( ::oBrw:bClrRowFocus != nil, ::oBrw:bClrRowFocus, ::bClrSelFocus ) )
          endif
      else
         aColors := Eval( ::bClrSel )
      endif
   else
      aColors := Eval( ::bClrStd )
      lTransparent := IfNil( ::lColTransparent, ::oBrw:lTransparent )
   endif

   hDC     := ::oBrw:GetDC()
   oFont   := ::oDataFont
   if ValType( oFont ) == "B"
      oFont = Eval( oFont, Self )
   endif
   nWidth  := ::nWidth
   if ::oBrw:lTransparent .and. Empty( ::oBrw:nColDividerStyle )
      nWidth   -= COL_EXTRAWIDTH
   endif

   if ::oBrush != nil
      if ValType( ::oBrush ) == "B"
         oBrush   := Eval( ::oBrush, Self )
      else
         oBrush   := ::oBrush
      endif
   endif

   if oBrush != nil
      hBrush      := oBrush:hBrush
      lBrush      := .t.
      lTransparent:= .f.
//   elseif ! lTransparent .and. !::lColTransparent
   elseif ! IfNil( ::lColTransparent, lTransparent )
      hBrush  := CreateColorBrush( aColors[ 2 ] )
   elseif ::lColTransparent == .t.
      hBrush := CreateColorBrush( 0 )
      lTransparent := .t.
   endif

   nStyle  := ::oBrw:nColDividerStyle
   nType   := ::nEditType

   if nStyle == 0
      nRectWidth := nWidth + 2
      nRectCol   := nCol
   elseif nStyle < 5 .and. nOrder > 1
      nRectWidth := nWidth + 1
      nRectCol   := nCol - 1
   else
      nRectWidth := nWidth
      nRectCol   := nCol
   endif

   nBottom  := nRow + nHeight
   if ! lTransparent
      nTop        := nRow
      if ::lMergeVert .and. lHighLite .and. lSelected .and. nOrder == ::oBrw:nColSel
         ::MergeArea( @nTop, @nBottom, nPaintRow )
      endif
      if ValType( aColors[ 2 ] ) == 'A'
         GradientFill( hDC, nTop, nRectCol, nBottom-1, Min( nRectCol + nRectWidth, ::oBrw:BrwWidth() ), aColors[ 2 ], .t. )
      else
         FillRect( hDC, { nTop, nRectCol, nBottom, Min( nRectCol + nRectWidth, ::oBrw:BrwWidth() ) }, hBrush )
      endif
   endif

   if ::bIndent != nil
      nIndent  := Eval( ::bIndent, Self )
      if ! Empty( nIndent )
         nCol   += nIndent
         nWidth -= nIndent
      endif
   endif

   nCol    += ( COL_EXTRAWIDTH / 2 )
   nWidth  -=  COL_EXTRAWIDTH
   nRow    += ( ROW_EXTRAHEIGHT / 2 )
   nHeight -=  ROW_EXTRAHEIGHT

//   if nType > 1
//      nButtonRow := nRow
//      nButtonCol := nCol + nWidth - 10
//      nWidth -= 15
//   endif

   if nType > 1
      if ! Empty( aBitmap := ::aBitmap( ::nBtnBmp ) )
         nBtnWidth      := aBitMap[ BITMAP_WIDTH ] + 1
         aBitmap        := nil
      else
         nBtnWidth      := IfNil( ::nBtnWidth, 10 )
      endif
      nButtonRow  := nRow
      nButtonCol  := nCol + nWidth - nBtnWidth
      nWidth      -= ( nBtnWidth + 5 )
   else
      if ::lWillShowABtn // to avoid the "dancing" of column data to the left
         nWidth -= ( IfNil( ::nBtnWidth, 10 ) + 5 )
      endif
   endif

   if ::lProgBar
      aColor2  := Eval( ::bClrProg )
      hBrush1  := CreateColorBrush( aColor2[ 1 ] )
      hBrush2  := CreateColorBrush( aColor2[ 2 ] )
      nWidth1  := Min( ::Value() * nWidth / ;
         Max( 1, If( ValType( ::nProgTot ) == 'B', Eval( ::nProgTot, Self ), ::nProgTot ) ), ;
         nWidth )

      FillRect( hDC, { nRow, nCol, nRow + nHeight, Min( nCol + nWidth1, ::oBrw:BrwWidth() - 4 ) }, hBrush1 )

      if nCol + nWidth1 < ::oBrw:BrwWidth() - 4
         FillRect( hDC, { nRow, nCol + nWidth1 + 1, nRow + nHeight, ;
             Min( nCol + nWidth, ::oBrw:BrwWidth() - 4 ) }, hBrush2 )
      endif
      DeleteObject( hBrush1 )
      DeleteObject( hBrush2 )

   endif

   if !Empty( aBitmap := ::aBitmap( nBmpNo ) )
      nWidth  -= aBitmap[ BITMAP_WIDTH ]
      if ::bStrData == nil .OR. ::nDataBmpAlign == AL_CENTER // Align Imagen SetCheck
         nBmpCol  := Max( 0, nCol + nWidth / 2 )
         lStretch := ::lBmpStretch

      elseif ::nDataBmpAlign == AL_LEFT
         nBmpCol := nCol
         nCol    += aBitmap[ BITMAP_WIDTH ] + BMP_EXTRAWIDTH
      else
         nBmpCol := nCol + nWidth
      endif
      nWidth  -= BMP_EXTRAWIDTH
      nBmpRow := nRow + ( ( nHeight - aBitmap[ BITMAP_HEIGHT ] ) / 2 )

      if ::lMergeVert
         nTop     := nRow
         nBottom  := nRow + nHeight - 1
         ::MergeArea( @nTop, @nBottom, nPaintRow )
         nBmpRow := nTop + ( ( ( nBottom - nTop + 1 ) - aBitmap[ BITMAP_HEIGHT ] ) / 2 )
      endif
      // Paint bitmaps
      /*DEFAULT*/ aBitmap[ BITMAP_ZEROCLR ] := GetZeroZeroClr( hDC, aBitmap[ BITMAP_HANDLE ] )

      if lStretch

         if SetAlpha() .and. aBitmap[ BITMAP_ALPHA ]
            hBmp := ResizeImg( aBitmap[ BITMAP_HANDLE ], Min( nRectWidth,::oBrw:BrwWidth() - nRectCol - 4 ), nBottom - nRow )
            ABPaint( hDC, nRectCol, nRow, hBmp, ::nAlphaLevel() )
         else
            nOldColor  := SetBkColor( hDC, nRGB( 255, 255, 255 ) )
            TransBmp( aBitmap[ BITMAP_HANDLE ], aBitmap[ BITMAP_WIDTH ], aBitmap[ BITMAP_HEIGHT ],;
                      aBitmap[ BITMAP_ZEROCLR ], hDC, nRectCol, nRow, Min( nRectWidth,::oBrw:BrwWidth() - nRectCol - 4 ), ;
                      nBottom - nRow )
            SetBkColor( hDC, nOldcolor )
         endif

      else
         if SetAlpha() .and. aBitmap[ BITMAP_ALPHA ]
            ABPaint( hDC, nBmpCol, nBmpRow,aBitmap[ BITMAP_HANDLE ], ::nAlphaLevel() )
         else
            if ::oBrw:lTransparent .or. ValType( aColors[ 2 ] ) == 'A' // transparent bitmaps with brush
                nOldColor := SetBkColor( hDC, nRGB( 255, 255, 255 ) )

                TransBmp( aBitmap[ BITMAP_HANDLE ], aBitmap[ BITMAP_WIDTH ], aBitmap[ BITMAP_HEIGHT ],;
                         aBitmap[ BITMAP_ZEROCLR ], hDC, nBmpCol, nBmpRow, aBitmap[ BITMAP_WIDTH ], ;
                         aBitmap[ BITMAP_HEIGHT ] )

                SetBkColor( hDC, nOldColor )
             else
                PalBmpDraw( hDC, nBmpRow, nBmpCol,;
                           aBitmap[ BITMAP_HANDLE ],;
                           aBitmap[ BITMAP_PALETTE ],;
                           aBitmap[ BITMAP_WIDTH ],;
                           aBitmap[ BITMAP_HEIGHT ];
                           ,, ::lBmpTransparent, aColors[ 2 ] )

            endif
         endif
      endif
   endif

   if ! Empty( cData ) .and. IsBinaryData( cData )
      if IfNil( FITypeFromMemory( cData ), -1 ) >= 0
         cImagen  := cData
         cData    := ''
      else
         cData    := RangeRepl( Chr(0), Chr(31), cData, '.' )
//         cData    := '<binary>'
      endif
   endif

   if ! Empty( cImagen ) .or. ::cDataType $ "FP"   // IMAGE
      if ! Empty( cImagen )
         hBmp     := FILoadFromMemory( cImagen )
      else
         if ::bStrImage == NIL
            cImagen := ::Value()
         else
            cImagen := Eval( ::bStrImage, Self, ::oBrw )
         endif
         if ::cDataType == 'F' .and. File( cImagen )
            hBmp     := FILoadImg( cImagen )
         else
            hBmp     := FILoadFromMemory( IfNil( cImagen, '' ) )
         endif
      endif

      aBmpPal     := { hBmp, 0 }
      if aBmpPal[ BITMAP_HANDLE ] == 0
         aBmpPal := PalBmpLoad( cImagen )
      endif

      if aBmpPal[ BITMAP_HANDLE ] != 0
         Aadd(aBmpPal, nBmpWidth( aBmpPal[ BITMAP_HANDLE ] ) )
         Aadd(aBmpPal, nBmpHeight( aBmpPal[ BITMAP_HANDLE ] ) )
         Aadd(aBmpPal, if ( ::lBmpTransparent, GetZeroZeroClr( hDC, aBmpPal[ BITMAP_HANDLE ] ),0) )
         Aadd(aBmpPal, HasAlpha( aBmpPal[ BITMAP_HANDLE ] ) )

         if ::lBmpStretch
            nBmpW       := nWidth - 2
            nBmpH       := nBottom - nRow - 2
            nBmpCol     := nCol + 1
            nBmpRow     := nRow + 1
         else
            nBmpW       := aBmpPal[ BITMAP_WIDTH ]
            nBmpH       := aBmpPal[ BITMAP_HEIGHT ]
            if nBmpW > ( nWidth - 4 )
               nBmpH    *= ( ( nWidth - 4 ) / nBmpW )
               nBmpW    := nWidth - 4
            endif
            if nBmpH > ( nBottom - nRow - 4 )
               nBmpW    *= ( ( nBottom - nRow - 4 ) / nBmpH )
               nBmpH    := ( nBottom - nRow ) - 4
            endif
            nBmpRow     := nRow + ( nHeight - nBmpH ) / 2 + 2
            nBmpCol     := nCol + 2

            if ::nDataBmpAlign == AL_CENTER
               nBmpCol  := nCol + ( nWidth - nBmpW ) / 2
            elseif ::nDataBmpAlign == AL_RIGHT
               nBmpCol  := nCol + nWidth - nBmpW
            endif

         endif

         if SetAlpha() .and. aBmpPal[ BITMAP_ALPHA ]

            hBmp := ResizeImg( aBmpPal[ BITMAP_HANDLE ], nBmpW, nBmpH )
            ABPaint( hDC, nBmpCol, nBmpRow, hBmp, ::nAlphaLevel() )
            DeleteObject( hBmp )

         elseif ::lBmpTransparent

            nOldColor := SetBkColor( hDC, nRGB( 255, 255, 255 ) )
            TransBmp( aBmpPal[ BITMAP_HANDLE ], aBmpPal[ BITMAP_WIDTH ], aBmpPal[ BITMAP_HEIGHT ],;
                      aBmpPal[ BITMAP_ZEROCLR ], hDC, nBmpCol, nBmpRow, nBmpW, nBmpH )
            SetBkColor( hDC, nOldColor )

         else

            if nBmpW != aBmpPal[ BITMAP_WIDTH ] .or. nBmpH != aBmpPal[ BITMAP_HEIGHT ]
               hBmp := ResizeImg( aBmpPal[ BITMAP_HANDLE ], nBmpW, nBmpH )
               DrawBitmap( hDC, hBmp, nBmpRow, nBmpCol )
               DeleteObject( hBmp )
            else
               DrawBitmap( hDC, aBmpPal[ BITMAP_HANDLE ], nBmpRow, nBmpCol )
            endif

         endif

      endif

   endif

   if ! Empty( cData ) .and. ! ( ::cDataType $ "PF" ) //.and. nType >= 0
      oFont:Activate( hDC )
      nFontHeight := GetTextHeight( ::oBrw:hWnd, hDC )
      if ::oBrw:lTransparent .and. ::oBrw:lContrastClr
         SetTextColor( hDC, ContrastColor( hDC, nCol, nRow, ;
            Min( nWidth, ::oBrw:BrwWidth() - nCol ), ;
            nHeight, aColors[ 1 ] ) )
      else
         SetTextColor( hDC, aColors[ 1 ] )
      endif
      if lTransparent .or. lBrush .or. ::lProgBar .or. ValType( aColors[ 2 ] ) == 'A'
         SetBkMode( hDC, 1 )
      else
         nOldColor := SetBkColor( hDC, aColors[ 2 ] )
      endif

      nTop     := nRow
      nBottom  := nRow + nHeight

      if ::lMergeVert
         ::MergeArea( @nTop, @nBottom, nPaintRow )
      endif

      aRect       := { nTop, nCol, nBottom, Min( nCol + nWidth, ::oBrw:BrwWidth() - 5 ) }
      if ::bPaintText == nil

         nStyle      := ::nDataStyle
         if ::oBrw:nDataType == DATATYPE_ARRAY .and. ;
            ::nDataStrAlign == AL_LEFT .and. ;
            ValType( ::Value ) $ 'ND'

            nStyle   := ::DefStyle( AL_RIGHT, .t. )
         endif
/*
         if ::cDataType == 'M' .and. ::nDataLines == nil
            if ::oBrw:nDataLines > 1
               ::nDataLines   := ::oBrw:nDataLines
            elseif ( ::oBrw:nRowHeight >= 2 * nFontHeight + 4 )
               ::nDataLines   := 2
               ::nDataStyle   := ;
               nStyle         := ::DefStyle( ::nDataStrAlign, .f. )
            endif
         endif
*/

         if CRLF $ cData .or. ( ::cDataType != nil .and. ::cDataType $ 'CM' .and. lAnd( nStyle, DT_SINGLELINE ) .and. ;
            ::oBrw:nRowHeight > 2 * nFontHeight + 2 )

            cData    := Trim( cData )
            if ( nTxtHeight := DrawTextEx( hDC, cData, aRect, nOr( DT_CALCRECT, DT_WORDBREAK ) ) ) > ;
                              DrawTextEx( hDC, cData, aRect, nOr( DT_CALCRECT, DT_SINGLELINE ) )

               nStyle      := nOr( nAnd( nStyle, nNot( DT_SINGLELINE ) ), DT_WORDBREAK )
               if lAnd( ::nDataStrAlign, AL_TOP )
                  // aRect[ 1 ]  += 0  // nothing to be done.
               elseif lAnd( ::nDataStrAlign, AL_BOTTOM )
                  aRect[ 1 ]  += Max( 0, Int( ( nHeight - nTxtHeight - 1 ) ) )
               else
                  aRect[ 1 ]  += Max( 0, Int( ( nHeight - nTxtHeight ) / 2 ) )
               endif

               if ::nDataLines == nil .and. ::cDataType == 'M'
                  ::nDataLines   := 2
               endif

            endif
         endif

         DrawTextEx( hDC, cData, aRect, nStyle )
      else
         Eval( ::bPaintText, Self, hDC, cData, aRect, aColors, lHighLite )
      endif
      if nOldColor != nil
         SetBkcolor( hDC, nOldColor )
         nOldColor := nil
      endif
      oFont:Deactivate( hDC )
   else
      aRect       := { nRow, nCol, nRow + nHeight, Min( nCol + nWidth, ::oBrw:BrwWidth() - 5 ) }
      if ::bPaintText != nil
         Eval( ::bPaintText, Self, hDC, "", aRect, aColors, lHighLite )
      endif
   endif

   if nType > 1 .and. nType < EDIT_DATE
      if lSelected
         if !::lBtnTransparent
               WndBoxRaised(hDC, nButtonRow -1 , nButtonCol - 1,;
                                 nButtonRow + nHeight, nButtonCol + nBtnWidth + 1 ) // ButtonGet
         endif

         if nType == EDIT_LISTBOX .or. nType == EDIT_GET_LISTBOX
           ::oBtnElip:Hide()
           ::oBtnList:Move( nButtonRow, nButtonCol, nBtnWidth + 1, nHeight, .f.) // ButtonGet
           ::oBtnList:Show()
           ::oBtnList:GetDC()
           if ::lBtnTransparent
              ::oBtnList:SetColor( aColors[ 1 ],aColors[ 2 ] )
           else
              FillRect( hDC, {nButtonRow, nButtonCol, nButtonRow + nHeight , nButtonCol + nBtnWidth + 1 } ,;   // ButtonGet
                       ::oBtnList:oBrush:hBrush  )
           endif
           ::oBtnList:Paint()
           ::oBtnList:ReleaseDC()
         else
            ::oBtnList:Hide()
            ::oBtnElip:Move( nButtonRow, nButtonCol, nBtnWidth + 1, nHeight, .f.) // ButtonGet
            ::oBtnElip:Show()
            ::oBtnElip:GetDC()
           if ::lBtnTransparent
              ::oBtnElip:SetColor( aColors[ 1 ],aColors[ 2 ] )
           else
              FillRect( hDC, {nButtonRow, nButtonCol, nButtonRow + nHeight , nButtonCol + nBtnWidth + 1 },; // ButtonGet
                      ::oBtnElip:oBrush:hBrush )
           endif
            ::oBtnElip:Paint()
            ::oBtnElip:ReleaseDC()
         endif
      endif
   endif

   if hBrush != nil .and. ! lBrush
      DeleteObject( hBrush )
   endif
   if aBmpPal != nil
      DeleteObject( aBmpPal[ BITMAP_HANDLE ]  )
   endif
   ::oBrw:ReleaseDC()

return nil
 


João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7316
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: xBrowse - No entiendo el error (Mr. Rao)

Postby MarioG » Fri May 29, 2015 1:13 pm

Karinha
Comparado con mi fuente; son iguales!

Estoy muy mareado; no entiendo nada :?
Probé así:
Code: Select all  Expand view
  WITH OBJECT oBrwPer:Chk
      :nWidth:= 50
      :nHeadStrAlign:= :nDataStrAlign:= AL_CENTER

      //:bStrData:= {|| "" }
      :SetCheck( { "bmp_Ok", "bmp_Ok2" }, TRUE ) // {|o, v| ( ::oDBPermi:Load(), ::oDBPermi:Permiso := v, ::oDBPermi:Save() ) }   // Agrego otro bmp
   END
   oBrwPer:CreateFromCode()       // <- ahora al final
 
el error se repite

Y hasta así!:
Code: Select all  Expand view
  WITH OBJECT oBrwPer:Chk
      :nWidth:= 50
      :nHeadStrAlign:= :nDataStrAlign:= AL_CENTER

      //:bStrData:= {|| "" }
      :SetCheck( , TRUE )   // la forma mas comun, como en los samples
   END
   oBrwPer:CreateFromCode()
 
tambien dá error
Esto me hace suponer que algo de mi código no funciona (solo que si quito SetCheck(), funciona!) :( .
Creo que lo voy a pasar a array, que es como tambien lo uso
Resistencia - "Ciudad de las Esculturas"
Chaco - Argentina
User avatar
MarioG
 
Posts: 1380
Joined: Fri Oct 14, 2005 1:28 pm
Location: Resistencia - Chaco - AR

Re: xBrowse - No entiendo el error (Mr. Rao)

Postby karinha » Fri May 29, 2015 1:31 pm

Si compilas en \samples\testxbrw.prg, el setcheck funciona?
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7316
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: xBrowse - No entiendo el error (Mr. Rao)

Postby MarioG » Fri May 29, 2015 1:54 pm

\samples\testxbrw.prg se jecuta correctamente! :?
Resistencia - "Ciudad de las Esculturas"
Chaco - Argentina
User avatar
MarioG
 
Posts: 1380
Joined: Fri Oct 14, 2005 1:28 pm
Location: Resistencia - Chaco - AR

Re: xBrowse - No entiendo el error (Mr. Rao)

Postby karinha » Fri May 29, 2015 2:06 pm

Intenta asi:

Code: Select all  Expand view

:SetCheck( { "bmp_Ok", .T. }, {|o, v| ( ::oDBPermi:Load(), ::oDBPermi:Permiso := v, ::oDBPermi:Save() ) } )
 
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7316
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: xBrowse - No entiendo el error (Mr. Rao)

Postby karinha » Fri May 29, 2015 2:17 pm

Code: Select all  Expand view

#include "FiveWin.Ch"
#include "ord.ch"
#include "xbrowse.ch"

//----------------------------------------------------------------------------//

REQUEST DBFCDX

//----------------------------------------------------------------------------//

function Main()

   local oDlg, oBrw, oFont

   USE CUSTOMER NEW ALIAS CUST SHARED
   SET ORDER TO TAG FIRST
   GO TOP

   DEFINE FONT oFont NAME 'TAHOMA' SIZE 0,-12
   DEFINE DIALOG oDlg SIZE 600,400 PIXEL TITLE 'XBrowse Totals' ;
      FONT oFont
   @ 10,10 XBROWSE oBrw SIZE -10,-30 PIXEL OF oDlg ;
      COLUMNS "First", "Married", "HireDate", "Age", "Salary" ;
      DATASOURCE "CUST" ;
      AUTOSORT CELL LINES FOOTERS NOBORDER FASTEDIT


   WITH OBJECT oBrw

      // Specific to columns
      :Married:SetCheck()

      :HireDate:cEditPicture  := "dd mmm yyyy"

      :Age:nFooterType        := AGGR_STD

      :Salary:nFooterType     := AGGR_SUM

      // for the entire browse
      :nEditTypes             := EDIT_GET
      :nStretchCol            := STRETCHCOL_WIDEST

      // finally
      :MakeTotals()
      :CreateFromCode()
   END

   @ oDlg:nHeight / 2 - 25, 10 BUTTON "Excel" SIZE 40,12 PIXEL OF oDlg ACTION oBrw:ToExcel()
   @ oDlg:nHeight / 2 - 25, 55 BUTTON "Excel" SIZE 40,12 PIXEL OF oDlg ACTION oBrw:Report()

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont
   CLOSE CUST

return (0)

//----------------------------------------------------------------------------//

init procedure PrgInit

    SET DATE ITALIAN
    SET CENTURY ON
    SET TIME FORMAT TO "HH:MM:SS"
    SET EPOCH TO YEAR(DATE())-50

    SET DELETED ON
    SET EXCLUSIVE OFF

    RDDSETDEFAULT( "DBFCDX" )

    XbrNumFormat( 'E', .t. )
    SetGetColorFocus()

return

//----------------------------------------------------------------------------//
 


João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7316
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: xBrowse - No entiendo el error (Mr. Rao)

Postby MarioG » Fri May 29, 2015 2:57 pm

No me quiere xBrowse :D
hice lo siguiente:
Code: Select all  Expand view
 oPerm:oDBPermi:SetFocus()
  REDEFINE XBROWSE oBrwPer ID 300 OF oDlg ;
           COLUMNS "DESCRIP",  "PERMISO"  ;
           HEADERS "Permisos", "Chk"      ;
           DATASOURCE Alias()
...
   WITH OBJECT oBrwPer:Chk
      :nWidth:= 50
      :nHeadStrAlign:= :nDataStrAlign:= AL_CENTER

      //:bStrData:= {|| "" }
      :SetCheck() //  { "bmp_Ok", "bmp_Ok2" }, {|o, v| ( ::oDBPermi:Load(), ::oDBPermi:Permiso := v, ::oDBPermi:Save() ) }
   END
   oBrwPer:CreateFromCode()
 
Sin exito!
Resistencia - "Ciudad de las Esculturas"
Chaco - Argentina
User avatar
MarioG
 
Posts: 1380
Joined: Fri Oct 14, 2005 1:28 pm
Location: Resistencia - Chaco - AR

Re: xBrowse - No entiendo el error (Mr. Rao)

Postby karinha » Fri May 29, 2015 3:00 pm

Mira se estes BMP no están corruptos. Estraño.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7316
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Next

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 52 guests