*------------------------------------------------------------------------------ * id : criadbf.prg *------------------------------------------------------------------------------ cls ncounter:=0 set date briti set cent on set epoc to 1990 set scor off aStructure := {} aadd(aStructure,{"CODIGO", "N",04,0}) aadd(aStructure,{"NOME", "C",20,0}) aadd(aStructure,{"ENDERECO","C",30,0}) aadd(aStructure,{"CIDADE", "C",16,0}) aadd(aStructure,{"ESTADO", "C",02,0}) aadd(aStructure,{"CEP", "C",09,0}) dbcreate("customer",aStructure) use customer new for ncounter := 1 to 100 append blank customer->codigo := ncounter customer->nome := "teste "+strzero(ncounter,4) customer->endereco := "Av. "+strzero(ncounter,6)+" Numero "+strzero(ncounter,3) customer->cidade := "Cidade "+strzero(ncounter,3) customer->estado := "PR" customer->cep := strzero(ncounter,5)+"-"+strzero(ncounter,3) next index on codigo to customer close all cls quit *------------------------------------------------------------------------------------ * F I M *------------------------------------------------------------------------------------ //Criando um Objeto TBrowse *------------------------------------------------------------------------------------- * id : tbw06.prg *------------------------------------------------------------------------------------- cls set date briti set cent on set epoc to 1990 set scor off #include "inkey.ch" @ 0,0 to 2,79 @ 1,5 say [Exemplo de uso do TBrowse] @ 3,0 to 23,79 use customer new && Abre o arquivo cutomer set index to cutomer && Abre o indice do arquivo oMybrowser := TBrowseDB(04,01,22,78) oColumm1 := TBColumnNew("Codigo Cliente",{|| customer->codigo}) oColumm2 := TBColumnNew("Nome do Cliente",{|| customer->nome}) oColumm3 := TBColumnNew("Endereço",{|| customer->endereco}) oColumm4 := TBColumnNew("Cidade",{|| customer->cidade}) oColumm5 := TBColumnNew("UF",{|| customer->estado}) oColumm6 := TBColumnNew("C.E.P.",{|| customer->cep}) oMybrowser:addColumn(ocolumm1) oMybrowser:addColumn(ocolumm2) oMybrowser:addColumn(ocolumm3) oMybrowser:addColumn(ocolumm4) oMybrowser:addColumn(ocolumm5) oMybrowser:addColumn(ocolumm6) do while .t. while (! oMybrowser:stabilize()) nkey := inkey() if nkey != 0 && Pressionada uma tecla durante a estabilização exit endif enddo if oMyBrowser:Stable && Checa se o objeto está estável inkey(0) endif *------------------------------------- * Controle das teclas pressionadas *------------------------------------- if nkey == K_UP oMyBrowser:up() elseif nkey == K_DOWN oMybrowser:down() elseif nkey == K_LEFT oMybrowser:left() elseif nkey == KRIGHT oMybrowser:right() elseif nkey == K_HOME oMybrowser:home() elseif nkey == K_END oMybrowser:end() elseif nkey == K_PGUP oMybrowser:pageUp() elseif nkey == K_PGDN oMybrowser:pageDown() elseif nkey == K_CTRL_PGUP oMybrowser:goTop() elseif nkey == K_CTRL_PGDN oMybrowser:goBottom() elseif nkey == K_CTRL_HOME oMybrowser:panHome() elseif nkey == K_CTRL_END oMybrowser:panEnd() elseif nkey == K_CTRL_LEFT oMybrowser:panLeft() elseif nkey == K_CTRL_RIGHT oMybrowser:panRight() elseif nkey == K_ESC exit endif enddo close all cls quit * F I M