Jump to content
Fivewin Brasil

TSBROWSE INSERINDO NOVO REGISTRO


Recommended Posts

OK. Um abraco ao amigo Betovsp.

O Refresh() funcionou mais ou menos: Ou sejam: o browse as vezes fica fora de foco com o navegar das setas. Consegui resolver com Reset() + Gopos(16,1), mesmo assim acho que ficou lento fazer o cursor ir para a ultima linha do browse.

Gostaria de saber como sair do browse e como tirar fora uma coluna vazia que aparece a direita do browse quando navego com as setas.

Obrigado

Edvaldo

Link to comment
Share on other sites

Olá Edvaldo,

para sair do Browse, basta criar um botão e especificar um fim a ele.: Ex.: oBrw:end(), com isso, irá fechar a dialog e sair.

No caso da coluna, o cursor chega até ela???

verifique no browse, se não tem uma coluna a mais ou seja, ADD mostrando um campo vazio, se não tiver, basta aumentar o tamanho das colunas dos campos que vc está mostrando atraves do SIZE.

Abraços.

Beto

betovsp@hotmail.com

(16)9148-1515

Ribeirão Preto/SP

Link to comment
Share on other sites

Edvaldo

utilize a propriedade nAdjColumn do TSBrowse, ela expande a ultima coluna pra o tamanho total do browse...

oBrw:nAdjColumn :=

exemplo: browse com 3 colunas

oBrw:nAdjColumn := 3

Marllon Figueiredo

Analista de Sistemas ERP/CRM

Porto Alegre - RS

marllonfigueiredo@hotmail.com

Link to comment
Share on other sites

Ok. Obrigado ao Marllon.

Ok. O browse tem 5 colunas: Codigo - Descricao - Quant. - Unitario - Total, mas nao funcionou o nAdjcolumn:=5: Continua uma coluna a direita do browse em branco quando ando com a seta ate a ultima coluna da direita.

A proposito: estou achando muito lento o seguinte na browse:

- Grava novo registro

append blank

- Mostra na tela e fica na ultima linha do browse

Reset() - (Refresh() nao funciona bem.)

GoPos(16,1) - (Browse tem 16 linhas)

Um abraco

Edvaldo

Link to comment
Share on other sites

vamos tentar resolver uma coisa de cada vez ok... dah pra postar a parte do codigo onde voce define o browse e onde voce incluiu o nAdjColumn?

Marllon Figueiredo

Analista de Sistemas ERP/CRM

Porto Alegre - RS

marllonfigueiredo@hotmail.com

Editado por - siscat on 15/06/2004 14:57:28

Link to comment
Share on other sites

Ok. Segue prg com a browse.

Obrigado

Edvaldo

#define _VIDEO_CH

#define _DDE_CH

#DEFINE SW_SHOWNA 8 // &H8

#DEFINE SW_SHOW 5 // &H5

#DEFINE SW_HIDE 0 // &H0

#include "TSBrowse.ch"

#include "FiveWin.ch"

#include "Colors.ch"

#define CLR_PINK nRGB( 255, 128, 128)

#define CLR_NBLUE nRGB( 128, 128, 192)

#define CLR_NBROWN nRGB( 130, 99, 53)

#define CLR_1 nRGB( 190, 215, 190 )

#define CLR_2 nRGB( 230, 230, 230 )

#define CLR_3 nRGB( 217, 217, 255 )

#define CLR_YELLO nRGB( 255, 255, 0 )

#define CLR_CINZA nRGB( 192, 192, 192 )

#define CLR_BRANCO nRGB( 223, 223, 223 )

Static aWChild, aFont[ 8 ], XVTNOTA:=0, cSay, oBrw[ 7 ]

Function telavenda()

Local own, oBrwa, fonte, fimarq:=0, XTOTALPAGO:=0, XTECLA:=0

aWChild := Array( 8 )

SET _3DLOOK ON

DEFINE FONT aFont[ 1 ] NAME "Arial" SIZE 0, -12

aFont[ 2 ] := TFont():New( "Wingdings", 0, -18,, .T.,,,,.F.,.F.,.F., 1 )

DEFINE FONT aFont[ 3 ] NAME "Arial" SIZE 0, -24 BOLD

DEFINE FONT aFont[ 6 ] NAME "HAETTENSCHWEILER" SIZE 0, -33 BOLD

DEFINE FONT aFont[ 5 ] NAME "HAETTENSCHWEILER" SIZE 0, -15 BOLD

DEFINE FONT aFont[ 2 ] NAME "HAETTENSCHWEILER" SIZE 0, -50 BOLD

DEFINE FONT aFont[ 7 ] NAME "Impact" SIZE 0, -30 BOLD

DEFINE FONT aFont[ 4 ] NAME "HAETTENSCHWEILER" SIZE 0, -40 BOLD

DEFINE FONT aFont[ 8 ] NAME "Impact" SIZE 0, -200 BOLD

aWChild := Array( 8 )

ShowWindow(FindWindow( 'Shell_TrayWnd',nil), SW_HIDE )

DEFINE WINDOW OWN TITLE "Balcão - Venda de produtos e serviços a clientes";

FROM 0,0 TO 604, 804 PIXEL;

SELE 3

xnnf=154943

SEEK XNNF

IF EOF()

sinal("Numero do pedido nao localizado !")

return

ENDIF

xreg=recno()

do while nnf=xnnf.and..not.eof()

xvtnota=xvtnota+totitem

skip

enddo

cSay:=LTRIM(TRANSFORM(XVTNOTA,"@E 999,999.99"))

go xreg

if eof()

fimarq=1

endif

@ 1,1 BROWSE oBrw[ 4 ] GRID ;

SIZE 794, 481 PIXEL ;

OF aWChild[ 4 ] FONT aFont[ 1 ] SELECT NNF FOR NNF:=xnnf TO xnnf;

ADD COLUMN TO oBrw[ 4 ];

HEADER "Código" ;

SIZE 97 ;

DATA FieldWBlock( "Cod", Select() ) ;

COLORS CLR_BLACK,CLR_CINZA; // degraded background color

3DLOOK TRUE;

ALIGN DT_LEFT

ADD COLUMN TO oBrw[ 4 ];

HEADER "Descrição dos produtos";

SIZE 377;

DATA FieldWblock( "Descricao", Select() ) ;

COLORS CLR_BLACK,CLR_CINZA ;

3DLOOK TRUE;

ALIGN DT_LEFT

ADD COLUMN TO oBrw[ 4 ] ;

HEADER "Quant" ;

SIZE 80 ;

DATA FieldWBlock( "QTD", Select() ) ;

PICTURE("@E 999.99");

COLORS CLR_BLACK, CLR_CINZA ;

3DLOOK TRUE;

ALIGN DT_CENTER

ADD COLUMN TO oBrw[ 4 ] ;

HEADER "Unitário " ;

SIZE 110 ;

DATA FieldWBlock( "VLUNI", Select() ) ;

PICTURE("@E 999,999.99");

COLORS CLR_BLACK,CLR_CINZA ;

3DLOOK TRUE;

ALIGN DT_RIGHT

ADD COLUMN TO oBrw[ 4 ] ;

HEADER "T o t a l " ;

SIZE 129 PIXELS ;

DATA FieldWBlock( "TOTITEM", Select() ) ;

PICTURE("@E 999,999.99");

COLORS CLR_BLACK,CLR_YELLO ; // degraded background color

3DLOOK TRUE;

ALIGN DT_RIGHT

oBrw[ 4 ]:lNoHScroll := .T.

oBrw[ 4 ]:nHeightCell += 2

oBrw[ 4 ]:nHeightHead += 3

oBrw[ 4 ]:ChangeFont( aFont[ 5 ], 1, Nil ) // (aFont[ 1 ], nColumn, nLevel)

oBrw[ 4 ]:ChangeFont( aFont[ 3 ], 2, Nil ) // (aFont[ 1 ], nColumn, nLevel)

oBrw[ 4 ]:SetColor({ 5, 6 },{ CLR_WHITE, CLR_BLACK } ) // cursor background

oBrw[ 4 ]:SetColor({ 5 },{ CLR_RED }, 2 ) // cursor background column 2

oBrw[ 4 ]:aColumns[ 2 ]:cMsg := "A different font for each column."

oBrw[ 4 ]:ChangeFont( aFont[ 3 ], 3, Nil ) // (aFont[ 1 ], nColumn, nLevel)

oBrw[ 4 ]:ChangeFont( aFont[ 3 ], 4, Nil ) // (aFont[ 1 ], nColumn, nLevel)

oBrw[ 4 ]:ChangeFont( aFont[ 3 ], 5, Nil ) // (aFont[ 1 ], nColumn, nLevel)

OBRW[4]:bkeydown={|nkey|iif(nkey#0,teclapress(nkey),)}

bmyblock:={|nRecno,oBrwa,lRecall|YesYouMay(nRecno,oBrwa,lRecall)}

bpostblock:={|oBrwa|Whateverupdate(oBrwa)}

oBrw[4]:setDeleteMode(.t.,.f.,bmyblock,bpostblock)

oBrw[ 4 ]:Set3DText( .T., .F.,, 2 )

oBrw[ 4 ]:Set3DText( .T., .T., 2, 1 )

oBrw[ 4 ]:Set3DText( .T., .T., 3, 1 )

oBrw[ 4 ]:Set3DText( .T., .T., 4, 1 )

oBrw[ 4 ]:Set3DText( .T., .T., 5, 1 )

oBrw[4]:nAdjcolumn:=5

oBrw[ 4 ]:bRClicked := { || oBrw[ 4 ]:ShowSizes() }

oBrw[ 4 ]:lNoResetPos := .F.

@ 16.06,0.14 say " A Receber" BORDER SIZE 142,39 centered font afont[ 7 ] COLORS CLR_BLACK,CLR_CINZA

@ 10.42,0.08 say oSay Var cSay BORDER SIZE 142,53 font IIF(XVTNOTA>10000,afont[4],AFONT[2]) colors CLR_BLACK,CLR_YELLOW CENTERED

@ 16.06,10.95 say " Recebido" BORDER SIZE 142,39 font afont[ 7 ] colors CLR_BLACK,CLR_CINZA

@ 10.42,6.55 say LTRIM(TRANSFORM(XTOTALPAGO,"@E 999,999.99")) BORDER SIZE 141,53 font IIF(XVTNOTA>10000,afont[4],AFONT[2]) colors CLR_BLACK,CLR_BRANCO CENTERED

@ 16.06,21.7 say " T r o c o" BORDER SIZE 142,39 font afont[ 7 ] colors CLR_BLACK,CLR_CINZA

@ 10.42,13 say LTRIM(TRANSFORM(IIF(XTOTALPAGO=0,0,XTOTALPAGO-XVTNOTA),"@E 999,999.99")) BORDER SIZE 142,53 font IIF(XVTNOTA>10000,afont[4],AFONT[2]) colors CLR_BLACK,CLR_BRANCO CENTERED

@ 16.06,32.5 say "" BORDER SIZE 366,93 font afont[ 7 ] colors CLR_BLACK,CLR_CINZA

if fimarq=1

@ 0.05,1 say "CAIXA" BORDER SIZE 600,220 FONT AFONTicon_smile_8ball.gif COLORS CLR_BLACK,CLR_CINZA CENTERED

@ 1.2,1 say "LIVRE" BORDER SIZE 600,220 FONT AFONTicon_smile_8ball.gif COLORS CLR_BLACK,CLR_CINZA CENTERED

endif

ACTIVATE WINDOW OWN ;

ON PAINT oBrw[ 4 ]:SetFocus()

ShowWindow(FindWindow( 'Shell_TrayWnd',nil), SW_SHOWNA)

Return Nil

function yesyoumay()

if .not. autoriza("01","S")

return .f.

endif

OP:=ESCOLHE2("Apagar venda do código "+TRIM(COD),"Não apagar o item vendido")

if op=1

xvtnota=xvtnota-totitem

mostratot()

return .t.

else

return .f.

endif

function Whateverupdate()

* .t. deixa o registro na tela sem permitir acesso

oBrw[4]:Reset()

oBrw[4]:Gopos(16,1)

return .f.

FUNCTION MOSTRATOT()

cSay:=LTRIM(TRANSFORM(XVTNOTA,"@E 999,999.99"))

oSay:Refresh()

RETURN NIL

function teclapress(nkey)

if nkey=13

adicione(0)

replace cod with "7890000000001",QTD WITH 10,VLUNI WITH 1.5,TOTITEM WITH 15,DESCRICAO WITH "TESTE DE ADICAO DE PRODUTOS",NNF WITH 154943

DESTRAVA()

xvtnota=xvtnota+totitem

mostratot()

oBrw[4]:Reset()

oBrw[4]:Gopos(16,1)

endif

return nil

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...