FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour XBROWSE selecci贸n de registros con barra espaciadora
Posts: 117
Joined: Sun Oct 08, 2017 12:51 PM
XBROWSE selecci贸n de registros con barra espaciadora
Posted: Thu May 31, 2018 11:53 PM
Hola Se帽ores !
De nuevo preguntando...
Hace poco que empec茅 a incursionar con el XBROWSE y evidentemente
no me llevo muy bi茅n con 茅l, pero me agrada mucho...

La pregunta es sencilla:
Tengo un XBROWSE con la base de datos rubros.dbf.
La idea es seleccionar los registros que quiero listar con la barra
espaciadora y que me marque la primer columna con una "X".
pero no se refresca cuando lo hago.
Pero si se graba en la base de datos

Les paso el c贸digo y una im谩gen.
Se que para ustedes ser谩 un tema sencillo, del cu谩l les voy
a estar muy agradecidos me echen una mano.

Code (fw): Select all Collapse
* RUBROS.PRG - Selecci贸n rubros. Compilar con BUILDX.BAT de FWH1709
* UV 31/05/2018 聽 聽 聽 聽 聽 聽 聽 
*
* Seleccionar rubros. 
*
#include "vta0000.ch"
#include "winapi.ch"
#include "report.ch"
#include "xbrowse.ch"
#define 聽VK_ENTER 13

EXTERNAL ORDKEYCOUNT, ORDKEYNO
REQUEST DBFCDX
EXTERN DBFCDX

*--------------------------------------
FUNCTION Main() 聽 聽 聽 聽 聽 聽 聽
*--------------------------------------
local 聽oDlg
local 聽oBrwr
local 聽lSave:=.f.

RDDSETDEFAULT("DBFCDX")
SET DATE FRENCH
SET CENTURY ON
SET EPOCH TO 1970
SET DECIMALS TO 2
SET CONFI ON
SET DELE ON
SET _3DLOOK ON
SetHandleCount(80)

REQUEST HB_Lang_ES
REQUEST HB_CODEPAGE_ESWIN
HB_LangSelect("ES")

sele 2
use rubros 

DEFINE DIALOG oDlg RESOURCE "RUBSEL" 聽

REDEFINE XBROWSE oBrwr ALIAS ALIAS(2) FIELDS ;
聽 聽 聽str(2->tilde1),;
聽 聽 聽str(2->rubro),;
聽 聽 聽2->Nombre ;
聽 聽 聽HEADERS;
聽 聽 聽"X",;
聽 聽 聽"Rub.",;
聽 聽 聽"Nombre" ;
聽 聽 聽ID 182 OF oDlg ;
聽 聽 聽SIZES 18,28,150聽 聽 

oBrwr:nMarqueeStyle 聽 聽 聽 := MARQSTYLE_HIGHLCELL 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 
oBrwr:nColDividerStyle 聽 聽:= LINESTYLE_BLACK 
oBrwr:nRowDividerStyle 聽 聽:= LINESTYLE_BLACK 
oBrwr:lColDividerComplete := .t. 
oBrwr:nHeaderLines 聽 聽 聽 聽:= 1 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽
oBrwr:nDataLines 聽 聽 聽 聽 聽:= 1 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽
oBrwr:lRecordSelector 聽 聽 := .t. 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 
oBrwr:bClrStd 聽 聽 聽 聽 聽 聽 := {|| { nRGB( 聽0, 聽0, 聽0), nRGB(255,248,220) } } 聽
oBrwr:bClrSelFocus 聽 聽 聽 聽:= {|| { nRGB( 聽0, 聽0, 聽0), nRGB(248,195, 34) } } 聽
oBrwr:SetFocus() 
oBrwr:Refresh() 
oBrwr:lVScroll := .t. 
oBrwr:lHScroll := .t.聽 聽 聽

oBrwr:bKeyDown:={|nKey| iif(nKey=32,TIL1200F(oBrwr),oBrwr:Refresh())}

REDEFINE BUTTON ID 115 OF oDlg ; 聽 聽 // SI
聽 聽 聽 聽 聽ACTION (lSave:=.t.,sysrefresh(),oDlg:End()) 聽
REDEFINE BUTTON ID 114 OF oDlg ; 聽 聽 // NO
聽 聽 聽 聽 聽ACTION (lSave:=.f.,sysrefresh(),CierraDbfs(),oDlg:End()) 
ACTIVATE DIALOG oDlg CENTERED

if lSave
聽 聽// Rutina de impresi贸n...
endif聽 聽
clos data
sysrefresh()
FreeResources()
return nil

*--------------------------------------
FUNCTION TIL1200F(oBrwr) 聽 // Para seleccionar registros con la barra espaciadora.
*--------------------------------------
// Marco el tilde1 en RUBROS.DBF con barra espaciadora
// el rubro que se va a listar.
sele 2
if 2->tilde1=" "
聽 聽sele 2
聽 聽repl tilde1 with "X"
else
聽 聽sele 2
聽 聽repl tilde1 with " "
endif
oBrwr:setfocus()
oBrwr:Refresh()
sysrefresh()
return nil

*-------------------------
FUNCTION CierraDbfs()
*-------------------------
set relation to
clos data
return nil


Pedro L. Lavallen

San Luis (Capital), Argentina
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: XBROWSE selecci贸n de registros con barra espaciadora
Posted: Sat Jun 02, 2018 01:11 AM
Code (fw): Select all Collapse
USE ITEMS SHARED NEW

REDEFINE XBROWSE oBrwr ID 182 OF oDlg ;
   DATASOURCE "ITEMS" ;
   COLUMNS "TILDE1", "CATEGORY", "Name" ;
   HEADERS "X", "Rub." ;
   COLSIZES 18,26,150 ;
   CELL LINES
   

oBrwr:bKeyChar := { |k,f,oCol| If( k == 32, ;
   ( oCol := oBrwr:oCol( 1 ), oCol:VarPut( If( Empty( oCol:Value ), "X", " " ) ), 0 ), nil ) }
      
// BUTTONS

ACTIVATE DIALOG oDlg CENTERED

CLOSE ITEMS
Regards



G. N. Rao.

Hyderabad, India
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: XBROWSE selecci贸n de registros con barra espaciadora
Posted: Sat Jun 02, 2018 03:52 PM

Hola.
No dudo que el codigo del Sr. Rao funcione.
Pero, siguiendo tu codigo, prueba modificando asi:
oBrwr:bKeyDown:={|nKey| iif( nKey=32, TIL1200F(oBrwr), ) }
Saludos

Francisco J. Alegr铆a P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql
Posts: 117
Joined: Sun Oct 08, 2017 12:51 PM
Re: XBROWSE selecci贸n de registros con barra espaciadora
Posted: Sat Jun 02, 2018 04:54 PM

Se帽ores Rao y Francisco, muchas gracias por sus respuestas !
Las 2 funcionaron perfectamente !!!
La respuesta de Francisco, muy sencilla, y la de Rao m谩s complicada
pero correcta tambi茅n.
Me gustar铆a aprender m谩s sobre la clase TXBROWSE y ver nuevos ejemplos.
Hasta ahora vi todos los que est谩n en la carpeta de FWH y en la p谩gina

http://wiki.fivetechsoft.com/doku.php?i ... eticamente.
驴 Hay alg煤n sitio donde se puedan ver m谩s ejemplos y/o tutoriales para apender m谩s sobre el tema ?
Gracias de nuevo, y saludos !

Pedro L. Lavallen

San Luis (Capital), Argentina
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: XBROWSE selecci贸n de registros con barra espaciadora
Posted: Sun Jun 03, 2018 01:23 AM

In these forums, I posted many samples showing the recommended and the best way to create and use XBrowse.
You can download a program from this thread

http://forums.fivetechsupport.com/viewt ... =3t=35170
With this program you can download and see all the samples I posted in these forums.
Please study these sample and adapt them to your needs.

&

Regards



G. N. Rao.

Hyderabad, India
Posts: 117
Joined: Sun Oct 08, 2017 12:51 PM
Re: XBROWSE selecci贸n de registros con barra espaciadora
Posted: Mon Jun 04, 2018 01:59 PM

Gracias amigo Rao.
Muy atento !

Pedro L. Lavallen

San Luis (Capital), Argentina

Continue the discussion