xbrowse

xbrowse

Postby surGom » Fri Feb 23, 2018 11:07 pm

Hola compañeros tengo un problema con un xbrowse que me muestra una columna con el texto tdialog, y no se como solucionarlo, les envío el prg y una imagen, para ver si me pueden orientar

Code: Select all  Expand view
#include "Fivewin.ch"

#define HA_LEFT  0
#define HA_RIGHT 1
#define HA_CENTER 2



FUNCTION selgan()

   LOCAL oRet, oBrw, ctext
   LOCAL nselectedrow := 0
   LOCAL cCodigo
   local odlg
   local lacepto := .f.
   local aDevuelvo := Array(0)

   IF !pasaje( "retgan830" ); RETURN nil; ENDIF
   database oRet
   oRet:setorder(1)


   DEFINE DIALOG odlg RESOURCE "DIA_XBROWSE2"
   odlg:cCaption := "Seleccionar Tipo de retención"

   REDEFINE XBrowse oBrw id 101 odlg DATASOURCE oRet ;
      columns { 1, 2, 3, 4, 5, 6 };
      COLSIZES 40, 60, 300, 85, 60, 60;
      HEADERS " ", "Código", "Concepto", "Importe Mínimo", "Tasa Insc.", "Tasa No Inscripto";
      LINES CELL update

   WITH OBJECT oBrw
      :nMarqueeStyle := MARQSTYLE_HIGHLCELL
      :nColDividerStyle := LINESTYLE_BLACK
      :nStretchCol := STRETCHCOL_LAST
      :lColDividerComplete := .T.
      :l2007 := .T.
      :lRecordSelector := .T.
      :lAllowColHiding := .F.
      :lAllowColSwapping := .F.
      :nStretchCol := STRETCHCOL_LAST
      :nRowHeight := 60
   END WITH

   WITH OBJECT oBrw:aCols[ 1 ]
         :bEditValue    := { || If( oBrw:BookMark == nselectedrow, .T., nil ) }
         :SetCheck()
         :nHeadBmpNo    := { || If( Empty( nselectedrow ), 2, 1 ) }

   END WITH

      oBrw:bLClicked     := {|r, c, f, oBrw| If( oBrw:MouseColPos( c ) == 1, ;
      If( nselectedrow != oBrw:BookMark, nselectedrow := oBrw:BookMark, nselectedrow := nil ), nil ), ;
         oBrw:RefreshCurrent(), aDevuelvo := fdevuelvo(oRet ) }

   WITH OBJECT oBrw:aCols[ 2 ]
      :bStrData := {|| oRet:codreg }
      :nDataStrAlign := AL_RIGHT
   END WITH

   WITH OBJECT oBrw:aCols[ 3 ]
      :bStrData := {|| cotexto(oRet:concepto) }                // CAMPOMEMO
      :nDataStrAlign := AL_LEFT

   END WITH

   WITH OBJECT oBrw:aCols[ 4 ]
      :bStrData := {|| oRet:minimo }
      :nDataStrAlign := AL_RIGHT
   END WITH

   WITH OBJECT oBrw:aCols[ 5 ]
      :bStrData := {|| oRet:tasains }
      :nDataStrAlign := AL_RIGHT
   END WITH

   WITH OBJECT oBrw:aCols[ 6 ]
      :bStrData := {|| oRet:tasanin }
      :nDataStrAlign := AL_RIGHT
   END WITH

   REDEFINE BUTTON ID 102 OF odlg ACTION (lacepto := .t., odlg:end())
   REDEFINE BUTTON ID 103 OF odlg ACTION odlg:end()

   ACTIVATE DIALOG odlg

   if lacepto
      return aDevuelvo
   endif
   CIERROALIAS(oRet:cAlias, oRet)


 return Array(0)

/////////////////////////////////////////////////////////////////////
function cotexto(ctext)
local ctexto := Space(85)


ctexto := SubStr(ctext,1,80) + CRLF + SubStr(ctext,81,160)
return ctexto
/////////////////////////////////////////////////////////////////////
function fdevuelvo(oRet )
local aDevuelvo := Array(0)
local cMinimo :=  StrTran(oRet:minimo,".","")
cMinimo := StrTran(cMinimo,",",".")

AAdd(aDevuelvo, Val( oRet:codreg))
AAdd(aDevuelvo, Val( oRet:tasains) )
AAdd(aDevuelvo, Val(cMinimo) )

return aDevuelvo

 


https://drive.google.com/file/d/1Tq5G-WonFwo2elniFoRGhUll9u03O1Or/view?usp=sharing

Y como puedo mostrar el campo memo completo ya que en algunos items no muestra todos los rengolone

Por lo demás lo que necesito que haga lo hace, pero no puedo sacar Tdialog, estimo que el problema esta en como defino la columna del setcheck()

Gracias por su atención

Luis
surGom
 
Posts: 639
Joined: Wed Oct 19, 2005 12:03 pm

Re: xbrowse

Postby cnavarro » Sat Feb 24, 2018 12:06 am

Quita en la claúsula HEADERS

Code: Select all  Expand view

HEADERS " ", "Código", "Concepto", "Importe Mínimo", "Tasa Insc.", "Tasa No Inscripto";
 


y déjalo asi

Code: Select all  Expand view

HEADERS "Código", "Concepto", "Importe Mínimo", "Tasa Insc.", "Tasa No Inscripto";
 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: xbrowse ( solucionado )

Postby surGom » Sat Feb 24, 2018 10:57 am

Gracias Cristobal, no lo habría podido solucionar sin tu ayuda.
El código quedo así

Code: Select all  Expand view
FUNCTION selgan()

   LOCAL oRet, oBrw, ctext
   LOCAL nselectedrow := 0
   LOCAL cCodigo
   local odlg
   local lacepto := .f.
   local aDevuelvo := Array(0)

   IF !pasaje( "retgan830" ); RETURN nil; ENDIF
   database oRet
   oRet:setorder(1)


   DEFINE DIALOG odlg RESOURCE "DIA_XBROWSE2"
   odlg:cCaption := "Seleccionar Tipo de retención"

   REDEFINE XBrowse oBrw id 101 odlg DATASOURCE oRet ;
      columns { 1, 2, 3, 4, 5  };                
      LINES CELL update


   WITH OBJECT oBrw
      :nMarqueeStyle := MARQSTYLE_HIGHLCELL
      :nColDividerStyle := LINESTYLE_BLACK
      :nStretchCol := STRETCHCOL_LAST
      :lColDividerComplete := .T.
      :l2007 := .T.
      :lRecordSelector := .T.
      :lAllowColHiding := .F.
      :lAllowColSwapping := .F.
      :nStretchCol := STRETCHCOL_LAST
      :nRowHeight := 60
   END WITH

   WITH OBJECT oBrw:aCols[ 1 ]
         :bEditValue    := { || If( oBrw:BookMark == nselectedrow, .T., nil ) }
         :SetCheck()
         :nHeadBmpNo    := { || If( Empty( nselectedrow ), 2, 1 ) }
         :nWidth   := 30
   END WITH

      oBrw:bLClicked     := {|r, c, f, oBrw| If( oBrw:MouseColPos( c ) == 1, ;
      If( nselectedrow != oBrw:BookMark, nselectedrow := oBrw:BookMark, nselectedrow := nil ), nil ), ;
         oBrw:RefreshCurrent(), aDevuelvo := fdevuelvo(oRet ) }

   WITH OBJECT oBrw:aCols[ 2 ]
      :bStrData := {|| oRet:codreg }
      :nDataStrAlign := AL_RIGHT
      :cHeader :=  "Código"
      :nWidth  :=  60
   END WITH

   WITH OBJECT oBrw:aCols[ 3 ]
      :bStrData := {|| cotexto(oRet:concepto) }
      :nDataStrAlign := AL_LEFT
      :cHeader := "Concepto"  
      :nHeadStrAlign := HA_CENTER
      :nWidth  :=   330
   END WITH

   WITH OBJECT oBrw:aCols[ 4 ]
      :bStrData := {|| oRet:minimo }
      :nDataStrAlign := AL_RIGHT
      :cHeader := "Importe mínimo"  
      :nWidth  :=   85
   END WITH

   WITH OBJECT oBrw:aCols[ 5 ]
      :bStrData := {|| oRet:tasains }
      :nDataStrAlign := AL_RIGHT
      :cHeader := "Tasa Insc"  
      :nWidth  :=   60
   END WITH

   WITH OBJECT oBrw:aCols[ 6 ]
      :bStrData := {|| oRet:tasanin }
      :nDataStrAlign := AL_RIGHT
      :cHeader := "Tasa No Ins."
      :nWidth  :=   60
   END WITH

   REDEFINE BUTTON ID 102 OF odlg ACTION (lacepto := .t., odlg:end())
   REDEFINE BUTTON ID 103 OF odlg ACTION odlg:end()

   ACTIVATE DIALOG odlg

   if lacepto
      return aDevuelvo
   endif
   CIERROALIAS(oRet:cAlias, oRet)


 return Array(0)
 


https://drive.google.com/file/d/1PRHQAlGzISrFzm3gFMXTg5MX6apb2xNX/view?usp=sharing

Si en columns en vez de poner { 1, 2, 3, 4, 5  }
ponés { 1, 2, 3, 4, 5, 6  }, como uno piensa que deberías ser, aparece el Tdialog en una 7ª columna.


Luis
surGom
 
Posts: 639
Joined: Wed Oct 19, 2005 12:03 pm

Re: xbrowse

Postby nageswaragunupudi » Sat Feb 24, 2018 3:07 pm

what I need you to do is It does, but I can not remove Tdialog

The reason is that there should be "OF" between ID number and oDlg

Wrong:
Code: Select all  Expand view

REDEFINE xBrowse oBrw id 101 oDlg ...
 


Correct:
Code: Select all  Expand view

REDEFINE xBrowse oBrw id 101 OF oDlg ...
 
Regards

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

Re: xbrowse

Postby nageswaragunupudi » Sat Feb 24, 2018 3:19 pm

This is the recommended code:
Code: Select all  Expand view
 REDEFINE XBROWSE oBrw ID 101 OF oDlg ;
      DATASOURCE oRet ;
      COLUMNS {||.f.}, "codreg", "concepto", "minimo", "tasains", "tasanin" ;
      COLSIZES 40, 60, 300, 85, 60, 60;
      HEADERS " ", "Código", "Concepto", "Importe Mínimo", "Tasa Insc.", "Tasa No Inscripto";
      JUSTIFY nil, .T., .F., .T., .T., .T. ;
      LINES CELL update

   WITH OBJECT oBrw
      :nMarqueeStyle := MARQSTYLE_HIGHLCELL
      :nColDividerStyle := LINESTYLE_BLACK
      :nStretchCol := STRETCHCOL_LAST
      :lColDividerComplete := .T.
      :l2007 := .T.
      :lRecordSelector := .T.
      :lAllowColHiding := .F.
      :lAllowColSwapping := .F.
      :nStretchCol := STRETCHCOL_LAST
//      :nRowHeight := 60   // Remove this line
      :nDataRows     := 2 // This wraps long text into multiple lines
   END WITH

   WITH OBJECT oBrw:aCols[ 1 ]
         :bEditValue    := { || If( oBrw:BookMark == nselectedrow, .T., nil ) }
         :SetCheck()
         :nHeadBmpNo    := { || If( Empty( nselectedrow ), 2, 1 ) }

   END WITH

   oBrw:bLClicked     := {|r, c, f, oBrw| If( oBrw:MouseColPos( c ) == 1, ;
   If( nselectedrow != oBrw:BookMark, nselectedrow := oBrw:BookMark, nselectedrow := nil ), nil ), ;
      oBrw:RefreshCurrent(), aDevuelvo := fdevuelvo(oRet ) }


/*
   REMOVE THIS CODE
   Also please never use bStrData. This is deprecated

   WITH OBJECT oBrw:aCols[ 2 ]
      :bStrData := {|| oRet:codreg }
      :nDataStrAlign := AL_RIGHT
   END WITH

   WITH OBJECT oBrw:aCols[ 3 ]
      :bStrData := {|| cotexto(oRet:concepto) }                // CAMPOMEMO
      :nDataStrAlign := AL_LEFT

   END WITH

   WITH OBJECT oBrw:aCols[ 4 ]
      :bStrData := {|| oRet:minimo }
      :nDataStrAlign := AL_RIGHT
   END WITH

   WITH OBJECT oBrw:aCols[ 5 ]
      :bStrData := {|| oRet:tasains }
      :nDataStrAlign := AL_RIGHT
   END WITH

   WITH OBJECT oBrw:aCols[ 6 ]
      :bStrData := {|| oRet:tasanin }
      :nDataStrAlign := AL_RIGHT
   END WITH
*/


   REDEFINE BUTTON ID 102 OF odlg ACTION (lacepto := .t., odlg:end())
   REDEFINE BUTTON ID 103 OF odlg ACTION odlg:end()

   ACTIVATE DIALOG odlg

   if lacepto
      return aDevuelvo
   endif
   CIERROALIAS(oRet:cAlias, oRet)


 return Array(0)
 
Regards

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

Re: xbrowse

Postby cnavarro » Sat Feb 24, 2018 6:16 pm

No sé si ha podido ser tu problema, pero por si acaso, ten en cuenta que

Code: Select all  Expand view

:lRecordSelector  := .T.
 


Esta columna no cuenta
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: xbrowse

Postby nageswaragunupudi » Sat Feb 24, 2018 6:23 pm

cnavarro wrote:No sé si ha podido ser tu problema, pero por si acaso, ten en cuenta que

Code: Select all  Expand view

:lRecordSelector  := .T.
 


Esta columna no cuenta

This does not make any difference.
Regards

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

Re: xbrowse

Postby cnavarro » Sat Feb 24, 2018 6:35 pm

nageswaragunupudi wrote:
cnavarro wrote:No sé si ha podido ser tu problema, pero por si acaso, ten en cuenta que

Code: Select all  Expand view

:lRecordSelector  := .T.
 


Esta columna no cuenta

This does not make any difference.


I think you have not understood my post
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: xbrowse

Postby nageswaragunupudi » Sat Feb 24, 2018 7:40 pm

You are right.
RecordSelector column does not count.
Regards

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

Re: xbrowse

Postby surGom » Sun Feb 25, 2018 12:18 pm

Thanks Mr. Rao.
Yes, just putting the "of" the original code worked.
I will also make the changes for you. suggested, because they simplify my code.

Luis
surGom
 
Posts: 639
Joined: Wed Oct 19, 2005 12:03 pm

Re: xbrowse

Postby surGom » Sun Feb 25, 2018 2:29 pm

Hice los cambios, pero en la 3ª columna "Concepto" me muestra solo un renglón.

Luis
surGom
 
Posts: 639
Joined: Wed Oct 19, 2005 12:03 pm

Re: xbrowse

Postby surGom » Sun Feb 25, 2018 2:51 pm

Si quito
ndatarow := 2 y pongo :nRowHeight := 60

funciona correctamente
surGom
 
Posts: 639
Joined: Wed Oct 19, 2005 12:03 pm

Re: xbrowse

Postby nageswaragunupudi » Sun Feb 25, 2018 2:58 pm

I wrongly said "nDataRows".

It should be nDataLines
Set nDataLines := 2 // or more

Let me explain:
If the vertical height of the cell can display more lines, xbrowse automatically split the text and show more lines.
You can do this in 2 ways.

oBrw:nRowHeight := <large value>
Or
oBrw:nDataLines := 2 // or more
depending on your requirement.

Even otherwise, user can increase the row-height at runtime by dragging the row separator with mouse.
Even then xbrowse displays the text in multi-line.
Regards

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

Re: xbrowse

Postby surGom » Sun Feb 25, 2018 3:10 pm

Y del código que quite deje

WITH OBJECT oBrw:aCols[ 3 ]
:bStrData := {|| cotexto(oRet:concepto) }
:nDataStrAlign := AL_LEFT
:nWidth := 330
END WITH
sin esto no funciona correctamente el campo memo

Luis
surGom
 
Posts: 639
Joined: Wed Oct 19, 2005 12:03 pm

Re: xbrowse

Postby nageswaragunupudi » Sun Feb 25, 2018 3:39 pm

XBrowse splits the line into 2 or more, only if the horizontal width of the cell cannot display the full text.
For example, if the width of the cell is less like 100, then you will see the text split into multiple lines
Regards

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


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 9 guests