Inhabilitar columna en xBrowse - Disable column in xBrowse

Post Reply
User avatar
FranciscoA
Posts: 1964
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Inhabilitar columna en xBrowse - Disable column in xBrowse

Post by FranciscoA »

Hola a todos.
¿Es posible inhabilitar determinadas columnas en xBrowse?

Se requiere que en un xBrowse de 5 columnas, inhabilitar la 2, 4 y 5, y asi poder navegar solamente en las columnas 1 y 3.
Gracias.

Hi all.
Is it possible to disable certain columns in xBrowse?

It is required that in a 5-column xBrowse, disable 2, 4 and 5, and thus be able to navigate only in columns 1 and 3.
Thanks,
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh1204-MySql-TMySql
VitalJavier
Posts: 188
Joined: Mon Jun 10, 2013 6:40 pm

Re: Inhabilitar columna en xBrowse - Disable column in xBrowse

Post by VitalJavier »

Francisco

Lo hice manual :

Code: Select all

oBrow2:lColChangeNotify := .T.
oBrow2:bChange  := {|nRow,nCol| IF(oBrow2:nColSel<>3, (oBrow2:nColSel:=3,oBrow2:Refresh()),"") }
 
asi controle que solo navegara en una sola columna
Podrias hacer algo con esto.

Saludos.
User avatar
FranciscoA
Posts: 1964
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: Inhabilitar columna en xBrowse - Disable column in xBrowse

Post by FranciscoA »

VitalJavier wrote:Francisco

Lo hice manual :

Code: Select all

oBrow2:lColChangeNotify := .T.
oBrow2:bChange  := {|nRow,nCol| IF(oBrow2:nColSel<>3, (oBrow2:nColSel:=3,oBrow2:Refresh()),"") }
 
asi controle que solo navegara en una sola columna
Podrias hacer algo con esto.

Saludos.
Javier:
Gracias por contestar.
Efectivamente, asi permite navegar solo en una columna.

Con el siguiente codigo puedo navegar solamente en columnas 1 y 2:

Code: Select all

      :lColChangeNotify := .t.
      :bChange  := { |o| if( o:nColSel>=3, ( o:nColSel:=2, o:RefreshCurrent() ), nil ) }
 
Seguiré intentando.
Saludos.
Francisco J. Alegría P.
Chinandega, Nicaragua.

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

Re: Inhabilitar columna en xBrowse - Disable column in xBrowse

Post by FranciscoA »

Con el código anterior se pueden establecer varias columnas siempre que sean contiguas.
La idea es navegar solamente en determinadas columnas, sean estas contiguas o no. Es decir, hacerlo sin cambiar posicion de columnas en el browse.

With the above code you can set multiple columns as long as they are contiguous.
The idea is to navigate only in certain columns, whether they are contiguous or not. This means do it without changing the position of the columns in the browse.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh1204-MySql-TMySql
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Inhabilitar columna en xBrowse - Disable column in xBrowse

Post by nageswaragunupudi »

This is a simple implementation.
This works when all columns are visible in the browse window,

Code: Select all

#include "fivewin.ch"

REQUEST DBFCDX

function Main()

   local oDlg, oBrw
   local aNavigate   := { 1, 3 }
   local nPrevCol    := aNavigate[ 1 ]

   USE CUSTOMER NEW ALIAS CUST SHARED VIA "DBFCDX"
   DEFINE DIALOG oDlg SIZE 850,500 PIXEL
   @ 10,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
      DATASOURCE "CUST" ;
      COLUMNS "FIRST","LAST","CITY","AGE","SALARY" ;
      CELL LINES NOBORDER

   WITH OBJECT oBrw
      :lAllowColSwapping   := .f.
      :lAllowColHiding     := .f.
      :nColSel          := nPrevCol
      :lColChangeNotify := .t.
      :bChange          := { |o| BrwChange( o, aNavigate, @nPrevCol ) }
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED

return nil

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

function BrwChange( oBrw, aNavigate, nPrevCol )

   local nColSel  := Min( Max( oBrw:nColSel, aNavigate[ 1 ] ), ATail( aNavigate ) )

   if AScan( aNavigate, nColSel ) == 0
      if nColSel > nPrevCol
         nColSel  := aNavigate[ AScan( aNavigate, { |n| n >= nColSel } ) ]
      else
         nColSel  := aNavigate[ RAScan( aNavigate, { |n| n <= nColSel } ) ]
      endif
   endif

   if nColSel != oBrw:nColSel
      oBrw:nColSel   := nColSel
      oBrw:RefreshCurrent()
   endif

   nPrevCol       := nColSel

return nil
Regards

G. N. Rao.
Hyderabad, India
User avatar
FranciscoA
Posts: 1964
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: Inhabilitar columna en xBrowse - Disable column in xBrowse

Post by FranciscoA »

Rao, gracias por tu amable atención.
Es lo que buscaba.

Rao, thank you, for your kind attention.
It's what i was looking for.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh1204-MySql-TMySql
Post Reply