hwgui 2.17
Enviado: 19 Fev 2024 00:54
Opa... não tenho o xhbdiff.txt em mãos agora mas me lembrei que não são colchetes e sim <> (maior e menor).alxsts escreveu:No xHarbour, este tipo de codeblock é delimitado por colchetes []
Opa... não tenho o xhbdiff.txt em mãos agora mas me lembrei que não são colchetes e sim <> (maior e menor).alxsts escreveu:No xHarbour, este tipo de codeblock é delimitado por colchetes []
Mestre Alexnadre,alxsts escreveu:Olá!Não consegue capturar o evento com aquele método ON OTHER MESSAGES (não me lembro se o nome é exatamente este mas é algo assim).sygecom escreveu:falta do ON GETFOCUS em alguns componentes,Este código é chamado de codeblock extendido. Veja a quantidade de código que existe entre as chaves {}, tendo inclusive declaração de variáveis LOCAL. Este é o padrão Harbour. No xHarbour, este tipo de codeblock é delimitado por colchetes [], conforme escrito naquele arquivo xhbdiff.txt. É só trocar as chaves pelos colchetes.sygecom escreveu:no xharbour ele diz que falta um }
Obrigado pela dica, nem lembrava mais do xhb-diff.txt, isso que usei ele a poucos dias quando estava ainda na etapa do apenas HARBOUR sem hwgui kkkkk mas vou consultar certamente deve ter mais outras coisas como essa.Obrigado.alxsts escreveu:Opa... não tenho o xhbdiff.txt em mãos agora mas me lembrei que não são colchetes e sim <> (maior e menor).alxsts escreveu:No xHarbour, este tipo de codeblock é delimitado por colchetes []
Código: Selecionar todos
@ 0,0 PANEL oPanel OF oTelaPrincipal SIZE 0,37
vPosicao=0
@ vPosicao,2 OWNERBUTTON OF oPanel;
ON CLICK {|| Pesquisa_Associado() } ;
SIZE 36,36 ;
FLAT;
BITMAP oBmpLogo9 FROM RESOURCE TRANSPARENT;
TOOLTIP "Cadastro de Associado"
vPosicao=vPosicao+39
@ vPosicao,2 OWNERBUTTON OF oPanel;
ON CLICK {|| FRMcad_mensal("C") } ;
SIZE 36,36 ;
FLAT;
BITMAP oBmpLogo12 FROM RESOURCE TRANSPARENT;
TOOLTIP "Cadastro de Mensalidade"
vPosicao=vPosicao+39
@ vPosicao,2 OWNERBUTTON OF oPanel;
ON CLICK {|| ShellExecute("calc") } ;
SIZE 36,36 ;
FLAT;
BITMAP oBmpLogo3 FROM RESOURCE TRANSPARENT;
TOOLTIP "Calculadora"
vPosicao=vPosicao+39
@ vPosicao,2 OWNERBUTTON OF oPanel;
ON CLICK {|| indexa() } ;
SIZE 36,36 ;
FLAT;
BITMAP oBmpLogo7 FROM RESOURCE TRANSPARENT;
TOOLTIP "Reindexa o Banco de Dados"
vPosicao=vPosicao+39
@ vPosicao,2 OWNERBUTTON OF oPanel;
ON CLICK {|| Back_up() } ;
SIZE 36,36 ;
FLAT;
BITMAP oBmpLogo2 FROM RESOURCE TRANSPARENT;
TOOLTIP "Realizar Back-Up do Banco de Dados"
vPosicao=vPosicao+39
@ vPosicao,2 OWNERBUTTON OF oPanel;
ON CLICK {|| Sendemail("suporte@xxx",1) } ;
SIZE 36,36 ;
FLAT;
BITMAP oBmpLogo8 FROM RESOURCE TRANSPARENT;
TOOLTIP "Suporte On-Line"
vPosicao=vPosicao+39
@ vPosicao,2 OWNERBUTTON OF oPanel;
ON CLICK {|| sobre() } ;
SIZE 36,36 ;
FLAT;
BITMAP oBmpLogo5 FROM RESOURCE TRANSPARENT;
TOOLTIP "Informações Sobre a Informática"
vPosicao=vPosicao+39
@ vPosicao,2 OWNERBUTTON OF oPanel;
ON CLICK {|| Ajuda_SCM() } ;
SIZE 36,36 ;
FLAT;
BITMAP oBmpLogo13 FROM RESOURCE TRANSPARENT;
TOOLTIP "Informações Sobre o SCM"
vPosicao=vPosicao+39
@ vPosicao,2 OWNERBUTTON OF oPanel;
ON CLICK {|| Sair() } ;
SIZE 36,36 ;
FLAT;
BITMAP 1005 FROM RESOURCE TRANSPARENT;
TOOLTIP "Sair do Sistema"
Código: Selecionar todos
@ 0,0 PANEL oPanel OF oTelaPrincipal SIZE 0,37
vPosicao=0
FOR EACH aItem IN { ;
{ oBmpLogo9, "Cadastro de Associado", { || Pesquisa_Associado() } }, ;
{ oBmpLogo12, "Cadastro de Mensalidade", { || frmCad_Mensal( "C" ) } }, ;
{ oBmpLogo3, "Calculadora", { || ShellExecute( "calc" ) } }, ;
{ oBmpLogo7, "Reindexa o Banco de Dados", { || Indexa() } }, ;
{ oBmpLogo2, "Realizar Backup do Banco de Dados", { || Back_up() } }, ;
{ oBtmpLogo8, "Suporte On-Line", { || SendEmail( "suporte@xxx",1) } }, ;
{ oBmpLogo5, "Informações sobre a Sygecom Informática", { || Sobre() } }, ;
{ oBmpLogo13, "Informações sobre o SCM", { || Ajuda_SCM() } }, ;
{ 1005, "Sair do Sistema", { || Sair() } } }
@ vPosicao, 2 OWNERBUTTON OF oPanel ;
ON CLICK aItem[ 3 ] ;
SIZE 36, 36 ;
FLAT ;
BITMAP aItem[1] FROM RESOURCE TRANSPARENT ;
TOOLTIP aItem[2]
vPosicao += 39
NEXT
Que eu me lembre, colchetes são pra array ou string ou hash.alxsts escreveu:Este código é chamado de codeblock extendido. Veja a quantidade de código que existe entre as chaves {}, tendo inclusive declaração de variáveis LOCAL. Este é o padrão Harbour. No xHarbour, este tipo de codeblock é delimitado por colchetes [], conforme escrito naquele arquivo xhbdiff.txt. É só trocar as chaves pelos colchetes.
Código: Selecionar todos
cTxt := [ {|| teste() } ]
bCode := &cTxt
Código: Selecionar todos
d:\github\dlgauto\source>c -Ld:\github\hwgui217 hwgui217.hbc hwgui.hbc
d:\github\dlgauto\source>d:\fontes\build\build.exe -Ld:\github\hwgui217 hwgui217.hbc hwgui.hbc
d:\github\dlgauto\source>HBMK2 test.hbp -Ld:\github\hwgui217 hwgui217.hbc hwgui.hbc -w3 -es2 -m -n -strip -compr -wo
rkdir=c:\temp -q -Id:\fontes\build\
hbmk2: Processing environment options: -comp=mingw
hbmk2: Processing configuration: d:\harbour\bin\hbmk.hbc
Harbour 3.2.0dev (r2402101027)
Copyright (c) 1999-2021, https://harbour.github.io/
lib_hwgui.prg:132: error E0030 Syntax error "syntax error at 'DIALOG'"
lib_hwgui.prg:134: error E0030 Syntax error "syntax error at 'DIALOG'"
lib_hwgui.prg:139: warning W0003 Variable 'XDLG' declared but not used in function '128:GUI_DIALOGACTIVATE'
lib_hwgui.prg:159: error E0030 Syntax error "syntax error at 'DIALOG'"
lib_hwgui.prg:163: warning W0003 Variable 'XDLG' declared but not used in function '143:GUI_DIALOGCREATE'
lib_hwgui.prg:163: warning W0003 Variable 'NROW' declared but not used in function '143:GUI_DIALOGCREATE'
lib_hwgui.prg:163: warning W0003 Variable 'NCOL' declared but not used in function '143:GUI_DIALOGCREATE'
lib_hwgui.prg:163: warning W0003 Variable 'NWIDTH' declared but not used in function '143:GUI_DIALOGCREATE'
lib_hwgui.prg:163: warning W0003 Variable 'NHEIGHT' declared but not used in function '143:GUI_DIALOGCREATE'
lib_hwgui.prg:163: warning W0003 Variable 'CTITLE' declared but not used in function '143:GUI_DIALOGCREATE'
3 errors
No code generated.
JoséQuintas escreveu:Que eu me lembre, colchetes são pra array ou string ou hash.
Não olhei o xhbdiff.txt pra ver que situação é essa diferente, se seria algo deste tipo.
Eu corrigi a informação imediatamente...alxsts escreveu:Opa... não tenho o xhbdiff.txt em mãos agora mas me lembrei que não são colchetes e sim <> (maior e menor).
xhb-diff.txt escreveu:### EXTENDED CODEBLOCKS ###
=================================
Both compilers support compile time extended codeblocks which allow
to use statements but with a little bit different syntax. Harbour uses
standard Clipper codeblock delimiters {}, f.e.:
? Eval( {| p1, p2, p3 |
? p1, p2, p3
return p1 + p2 + p3
}, 1, 2, 3 )
and xHarbour <>, f.e.:
? Eval( <| p1, p2, p3 |
? p1, p2, p3
return p1 + p2 + p3
>, 1, 2, 3 )
In Harbour extended codeblocks works like nested functions and supports
all function attributes, f.e. they can have own static variables or
other declarations which are local to extended codeblocks only and
do not effect upper function body.
In xHarbour the compiler was not fully updated for such functionality
and extended codeblocks were added to existing compiler structures what
causes that not all language constructs work in extended codeblocks
and creates a set of very serious compiler bugs, f.e., like in this code
with syntax errors but which is compiled by xHarbour without even single
warning giving unexpected results at runtime:
#ifndef __XHARBOUR__
#xtranslate \<|[<x,...>]| => {|<x>|
#xcommand > [<*x*>] => } <x>
#endif
proc main()
local cb, i
for i:=1 to 5
cb := <| p |
? p
exit
return p * 10
>
?? Eval( cb, i )
next
return
It's possible to create many other similar examples which are mostly
caused by missing in the compiler infrastructure for nested functions
support.
This can be fixed if someone invest some time to clean xHarbour compiler.
Código: Selecionar todos
aCode := { ;
| a, b |
LOCAL c := 10
RETURN a + b + c }
Código: Selecionar todos
PROCEDURE Main
LOCAL aBlock
SetMode(30,100)
CLS
aBlock := { | a, b, c | ;
c := 10, ;
a + b + 10 }
? Eval( aBlock, 1, 2 )
Inkey(0)
RETURN
Código: Selecionar todos
aBlock := { | a | a +=1, a += 1, a+= 1 }
? Eval( aBlock, 1 )
Código: Selecionar todos
LOCAL bCol1 := {|o,h,x1,y1,x2,y2,nc,nr|
hwg_Fillrect( h, x1, y1, x2, y2, Iif( !Empty(o:brush), o:brush:handle, oBrw:handle ) )
IF Eval( o:block )
hwg_DrawTransparentBitmap( h, oBmpCheck:handle, x1+2, y1+2 )
ENDIF
RETURN Nil
}
LOCAL bEnter := {|o,nc|
IF nc == 1
(o:alias)->(rlock())
(o:Alias)->(Eval( o:aColumns[nc]:block, !Eval( o:aColumns[nc]:block ) ))
(o:alias)->(dbunlock())
o:Refresh()
RETURN .T.
ENDIF
RETURN .F.
}Então.... de forma simples, compare istoItamar M. Lins Jr. escreveu:Esse aqui até hoje eu estudo. Esse "return nil" dentro e tudo mais.
Código: Selecionar todos
{|o,h,x1,y1,x2,y2,nc,nr|
hwg_Fillrect( h, x1, y1, x2, y2, Iif( !Empty(o:brush), o:brush:handle, oBrw:handle ) )
IF Eval( o:block )
hwg_DrawTransparentBitmap( h, oBmpCheck:handle, x1+2, y1+2 )
ENDIF
RETURN Nil
}
Código: Selecionar todos
FUNCTION SemNome( o,h,x1,y1,x2,y2,nc,nr)
hwg_Fillrect( h, x1, y1, x2, y2, Iif( !Empty(o:brush), o:brush:handle, oBrw:handle ) )
IF Eval( o:block )
hwg_DrawTransparentBitmap( h, oBmpCheck:handle, x1+2, y1+2 )
ENDIF
RETURN Nil
Código: Selecionar todos
aBlock := { | a |
a +=1
a += 1
a+= 1
RETURN a
}
Código: Selecionar todos
FUNCTION CalcImposto( nValor, nAliquota )
LOCAL nImposto
nImposto := nValor * nAliquota / 100
RETURN nImposto
Código: Selecionar todos
{ | nValor, nAliquota |
LOCAL nImposto
nImposto := nValor * nAliquota / 100
RETURN nImposto
}
Código: Selecionar todos
CalcImposto( 1000, 10 )
Código: Selecionar todos
Eval( variavel, 1000, 10 )
Código: Selecionar todos
RETURN Imposto }
Harbour 3.2.0dev (r2402101027)
Copyright (c) 1999-2021, https://harbour.github.io/
test.prg:18: error E0030 Syntax error "syntax error at '}'"
test.prg:18: warning W0007 Function '{||...}' does not end with RETURN statement
1 error
Código: Selecionar todos
aBlock := { ;
| Valor, AliquotaIcms |
Código: Selecionar todos
@ 6,4 OWNERBUTTON oOwnerbutton2 OF oPanel1 SIZE 52,40 ;
TEXT 'Usuarios' ;
FONT HFont():Add( 'MS Sans Serif',0,-11,400,,,) ;
COORDINATES 0, 22, 0, 0 ; // FLAT;
BITMAP 'C:\CONTROLE_\IMAGEM\smopen.bmp' ; //FROM RESOURCE TRANSPARENT ;
COORDINATES 0, 4, 0, 0 ;
ON CLICK {|| ThisForm:CLOSE() }