Contenido de campo en combox

Contenido de campo en combox

Postby jaba » Wed Jan 23, 2008 12:19 am

Hola Antonio

Mis mejores deseos para ti y para los que tu mas quieres.

Antonio como puedo hacer para que el contenido de un campo tipo carácter se me muestre en un combobox, encontré algo parecido en el foro pero no me funciona, quiero colocar el tramo de texto con el que trabajo para que me sea más fácil entender.
La parte a que se refiere la pregunta esta resaltada es el combobox operarios

Cordialmente

Jairo Barbosa
********************************************************************
#include "FiveWin.ch"

Function Busqueoper()//Muestra las operaciones de la tabla Oper

Local oDlg, oBrw, oBt1, oBt2, oBt3, oBt4, oBt5, oBt6,oBt,oReport


DEFINE DIALOG oDlg RESOURCE "Operaciones"

Select opera

REDEFINE LISTBOX oBrw ;
FIELDS ;
Opera->Placa ,;
DTOC(Opera->Fechaingre) ,;
Opera->Descrip ,;
str(Opera->Cantidad,7,3) ,;
str(Opera->Valor,13) ,;
Opera->Carga ,;
Opera->Operario ,;
IF(Opera->Garanth,"SI","NO") ,;
IF(Opera->Garantm,"SI","NO") ,;
Opera->Ot ,;
Opera->Ingreso ,;
DTOC(Opera->Fechasal) ,;
Opera->Coment ;
ID 519 OF oDlg ;
HEADERS ;
"Placa" ,;
"Fecha_Ingr" ,;
"Descripcion" ,;
"Cantidad" ,;
"Valor" ,;
"Carga" ,;
"Operario" ,;
"Garantia_H" ,;
"Grarantia_M" ,;
"Orden T" ,;
"Ingreso X" ,;
"Fecha_Sal" ,;
"Comentario" ;
SELECT Opera->Placa FOR Client->Placa ;
ON DBLCLICK (Regi02(.F.), oBrw:refresh(), oBrw:SetFocus()) UPDATE;
COLOR RGB(0,0,0),RGB(120,150,220)

REDEFINE Bitmap oBit ID 10 of oDlg resource "Genesis3"

oDlg:cCaption := "REGISTRO DE OPERACIONES"
oBrw:Upstable()

* Botones
REDEFINE BUTTON oBt1 ID 510 OF oDlg ; //Reeditar
ACTION (Regi02(.F.),Grabareg(), oBrw:refresh(), oBrw:SetFocus()) UPDATE
REDEFINE BUTTON oBt2 ID 517 OF oDlg ; // Nuevo
ACTION Grabareg(), (Regi02(.F.), oBrw:refresh(), oBrw:SetFocus())

REDEFINE BUTTON oBt3 ID 511 OF oDlg ; // borrar
ACTION ( BorraRegi02() , oBrw:refresh(), oBrw:SetFocus())

REDEFINE BUTTON oBt4 ID 518 OF oDlg ; // Salir
ACTION oDlg:End()

REDEFINE BUTTON oBt1 ID 533 OF oDlg ACTION Imprime()

oBrw:nClrpane:={||IIF((ORDKEYNO());
%2==0,RGB(120,150,250),RGB(120,150,200))}

ACTIVATE DIALOG oDlg

Return nil
//----------------------------------------------------------------------------//

function Regi02(lOk)

local oDlg,bGotFocus,bLostFocus,cOperario := {}
local lGrabaa := .F.
local Regis

* Seteamos las variables para agregar o modificar
cPlaca :=IIF(lOk,SPACE(LEN(Opera->Placa)),Opera->Placa)
cFechasal :=IIF(lOk,CTOD(" / / "),Opera->Fechasal)
cDescrip :=IIF(lOk,SPACE(LEN(Opera->Descrip)),Opera->Descrip)
cCantidad :=IIF(lOk,SPACE(LEN(Opera->Cantidad)),Opera->Cantidad)
cCarga :=IIF(lOk,SPACE(LEN(Opera->Carga)),Opera->Carga)
cValor :=IIF(lOk,SPACE(LEN(Opera->Valor)),Opera->Valor)
cOperario :=IIF(lOk,SPACE(LEN(Opera->Operario)),Opera->Operario)
cGaranth :=IIF(lOk,SPACE(LEN(Opera->Garanth )),Opera->Garanth )
cGarantm :=IIF(lOk,SPACE(LEN(Opera->Garantm)),Opera->Garantm)
cOt :=IIF(lOk,SPACE(LEN(Opera->ot)),Opera->ot)
cIngreso :=IIF(lOk,SPACE(LEN(Opera->Ingreso)),Opera->Ingreso)
cFechaingre :=IIF(lOk,SPACE(LEN(Opera->fechaingre)),Opera->Fechaingre)
cComent :=IIF(lOk,SPACE(LEN(Opera->Coment)),Opera->Coment)

aItems := {" ","1R_134","2R_12","3R134_Tar","4R12_Tar"}
aItem := {" ","A/C Nuevo","Servicio","Garantia"}
cRegis :=Recno()

DEFINE DIALOG oDlg RESOURCE "Regi02" TITLE "Entrada Operaciones Serviairee"

REDEFINE GET getplaca VAR cPlaca ID 500 OF oDlg UPDATE PICTURE "!!!999"

REDEFINE GET getFechaingre VAR cFechaingre ID 501 OF oDlg UPDATE;
VALID ValidCamp(cFechaingre)

* Desabilitamos placa cuando se edita y damos foco a Fecha (por Editar)
IF !lOk
Getplaca:disable()
GetFechaIngre:SetFocus()
ENDIF

REDEFINE GET getDescrip VAR cDescrip ID 502 OF oDlg PICTURE "@!"


REDEFINE GET getCantidad VAR cCantidad ID 503 OF oDlg PICTURE"99.999"

IF EMPTY(cCarga) .OR. ;
ASCAN(aItems,cCarga) == 1
cCarga := aItems[1]
ENDIF

REDEFINE COMBOBOX getCarga VAR cCarga ;
ITEMS aItems ID 504 of oDlg

REDEFINE GET getvalor VAR cValor ID 499 OF oDlg UPDATE PICTURE;
"$ 99,999,999.99"

Emple->( DbGoTop() ) //emple es el alias de la base empleados
while ! Emple->( EoF() )
AAdd(cOperario , Str( Emple->Apellido ) )
Emple->( DbSkip( 1 ) )
end

REDEFINE COMBOBOX getOperario VAR cOperario ID 505 OF oDlg PICTURE "@!"

REDEFINE CHECKBOX chetGaranth VAR cGaranth ID 506 OF oDlg UPDATE
if .not. empty(cGaranth)
cIngreso= aItem[4]
endif

REDEFINE CHECKBOX chetgarantm VAR cGarantm ID 507 OF oDlg UPDATE
if .not. empty(cGarantm)
cIngreso= aItem[4]
endif

REDEFINE GET getot VAR cOt ID 498 OF oDlg UPDATE;
VALID ValidCamp(cOt)

IF EMPTY(cIngreso) .OR. ;
ASCAN(aItem,cIngreso) == 1
cIngreso := aItem[1]
ENDIF

REDEFINE COMBOBOX getIngreso VAR cIngreso ;
ITEMS aItem ID 117 of oDlg valid ValidCamp(cIngreso)

REDEFINE GET getfechasal VAR cFechasal ID 4001 OF oDlg UPDATE

REDEFINE GET getcoment VAR cComent ID 508 OF oDlg


* Salimos sin Grabar
REDEFINE BUTTON oBt5 ID 521 OF oDlg ACTION (lGrabaa := .F., oDlg:End())//Salir
* Salimos grabando

REDEFINE BUTTON oBt6 ID 520 OF oDlg ACTION (lGrabaa := .T.,oDlg:End())

REDEFINE Bitmap oBit ID 10 of oDlg resource "Genesis1"

oBt6:cToolTip := ( "Graba el Registro Editado" )//OemToAnsi
getFechaingre:cToolTip :=OemToAnsi("Escriba la fecha de ingreso ")


ACTIVATE DIALOG oDlg

IF lGrabaa // Salir grabando
IF lOK

append blank

ENDIF
* Grabamos losdatos

Opera->Fechasal :=cFechasal
Opera->Descrip :=cDescrip
Opera->Cantidad :=cCantidad
Opera->Valor :=cValor
Opera->Carga :=cCarga
Opera->Operario :=cOperario
Opera->Garanth :=cGaranth
Opera->Garantm :=cGarantm
Opera->Ot :=cOt
Opera->Ingreso :=cIngreso
Opera->Fechaingre :=cFechaingre
Opera->Coment :=cComent

endif

return nil
jaba
 
Posts: 109
Joined: Tue Dec 12, 2006 12:39 am
Location: CALI COLOMBIA

Postby Antonio Linares » Wed Jan 23, 2008 8:58 am

Jairo,

Tienes que usar la Clase TDbCombo.

Revisa samples\DbcTest.prg y TestDbc1.prg
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41289
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby jaba » Wed Jan 23, 2008 12:34 pm

Antonio Linares wrote:Jairo,

Tienes que usar la Clase TDbCombo.

Revisa samples\DbcTest.prg y TestDbc1.prg


//**************************//

Gracis Antonio

funciona perfectamente

Cordialmente

Jairo
jaba
 
Posts: 109
Joined: Tue Dec 12, 2006 12:39 am
Location: CALI COLOMBIA


Return to FiveWin para CA-Clipper

Who is online

Users browsing this forum: No registered users and 4 guests

cron