Page 1 of 1
Inhabilitar columna en xBrowse - Disable column in xBrowse
Posted: Sat Sep 19, 2020 2:24 am
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,
Re: Inhabilitar columna en xBrowse - Disable column in xBrowse
Posted: Sat Sep 19, 2020 4:37 am
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.
Re: Inhabilitar columna en xBrowse - Disable column in xBrowse
Posted: Sat Sep 19, 2020 3:19 pm
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.
Re: Inhabilitar columna en xBrowse - Disable column in xBrowse
Posted: Sat Sep 19, 2020 3:30 pm
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.
Re: Inhabilitar columna en xBrowse - Disable column in xBrowse
Posted: Mon Sep 21, 2020 12:11 pm
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
Re: Inhabilitar columna en xBrowse - Disable column in xBrowse
Posted: Mon Sep 21, 2020 3:21 pm
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.