Como Usar o SetFocus() do clipper5.2
Enviado: 15 Nov 2011 15:21
O ERRO ocorre no momento que a linha Get:SetFocus() é acionada.
O Foco não fica no Lugar onde foi setado no: Get:Col(), Get:Row()
Segue o Programa.Prg e o "EXE" anexo
O Foco não fica no Lugar onde foi setado no: Get:Col(), Get:Row()
Segue o Programa.Prg e o "EXE" anexo
Código: Selecionar todos
---------------------------------
#include "common.ch"
#include "inkey.ch"
Clear Screen
Set Date Brit
Set cent on
dd:= Date()
dlr:= 0
ln:= {21}
cl:= {29}
camp:= {"DLR"}
private bl_c[1], b_v[1]
b_pe:= {Nil}
b_po:= {{|| dlr > 0}}
masc:= {"99,999,999.999"}
SetColor('15/7')
DevPos(21, 1)
DevOut("DOLAR DO DIA " + DToC(dd) + " U$: ")
setcursor(1)
pd_gets(ln, cl, camp, b_v, masc, bl_c, b_pe, b_po)
ReadModal(getlist)
getlist:= {}
if (LastKey() == K_ESC)
Clear
Quit
endif
*----------------
function PD_GETS( nln, ncl, qcpo, nb_v, nmas, bloc, bope, bopo)
local VL1, VL2, VL3, VL4:= 1, VL5:= Set(29), ;
VL6, VL7, VL8, VL9, VL10, VL11
begin sequence
aeval(getlist, {|_1| _1:display()})
for VL11:= 1 to Len(nln)
VL6:= qcpo[VL11]
DevPos(nln[VL11], ncl[VL11])
DevOutPict(&VL6, nmas[VL11])
next
while (VL4 <= Len(nln))
dado:= qcpo[VL4]
get:= getnew()
get:row(nln[VL4])
get:col(ncl[VL4])
get:block(&("{|valor| IF(PCOUNT()>0,&dado.:=valor,&dado.)}"))
get:name(qcpo[VL4])
get:picture(nmas[VL4])
get:colorspec(bloc[VL4])
get:preblock(bope[VL4])
get:postblock(bopo[VL4])
VL8:= VL9:= VL10:= 0
get:setfocus()
VL1:= iif(get:typeout(), .T., .F.)
if (get:preblock() != Nil)
if (!eval(get:preblock(), get))
if (LastKey() == K_UP)
VL4:= VL4 - iif(VL4 == 1, 0, 1)
loop
else
VL4++
loop
endif
endif
endif
VL6:= ""
VL4:= iif(VL4 > Len(nln), VL4 - 1, VL4)
if (get:type() == "N" .AND. !VL1)
for VL10:= 1 to Len(nmas[VL4])
VL8:= VL8 + iif(SubStr(nmas[VL4], VL10, ;
1) == ",", 1, 0)
next
VL9:= Len(nmas[VL4]) - (VL8 + 6)
endif
while (!VL1)
VL2:= InKey(0)
do case
case VL2 == 5
if (VL4 == 1)
get:undo()
VL1:= .F.
else
VL4:= VL4 - 1
VL1:= .T.
endif
case VL2 == 24
if (get:postblock() != Nil)
VL1:= iif(eval(get:postblock(), get), .T., .F.)
else
VL1:= .T.
endif
case VL2 == 27
get:undo()
get:killfocus()
break(Nil)
case VL2 == 18
VL4:= 0
VL1:= .T.
case VL2 == 3
VL4:= Len(nln) - 1
VL1:= .T.
case VL2 == 29
VL1:= .T.
case VL2 == 23
VL1:= .T.
case VL2 == 13
VL1:= .T.
case VL2 == 21
get:undo()
case VL2 == 22 .AND. get:type() != "N"
VL5:= !VL5
case VL2 == 1
get:home()
case VL2 == 6
get:end()
case VL2 == 4
get:right()
case VL2 == 19
get:left()
case VL2 == 2
get:wordright()
case VL2 == 26
get:wordleft()
case VL2 == 8
if (get:type() == "N")
get:backspace()
get:colorspec(bloc[VL4])
VL6:= Left(VL6, Len(VL6) - 1)
gat1:= Val(VL6)
DevPos(nln[VL4], ncl[VL4])
DevOutPict(gat1, nmas[VL4])
SetPos(nln[VL4], Col() - 1)
else
get:backspace()
endif
case VL2 == 7
get:delete()
case VL2 == 20
get:delwordrig()
case VL2 == 25
get:delend()
case VL2 >= 32 .AND. VL2 <= 127
VL3:= Chr(VL2)
if (get:type() == "N" .AND. (VL3 == "." .OR. ;
VL3 == ","))
get:todecpos()
VL6:= VL6 + VL3
elseif (VL5 .AND. get:type() != "N")
get:insert(VL3)
elseif (get:type() != "N")
get:overstrike(VL3)
else
get:overstrike(VL3)
get:colorspec(bloc[VL4])
VL6:= VL6 + VL3
if (At(".", nmas[VL4]) > 0 .AND. ;
Left(nmas[VL4], 2) = "@E")
if (Len(VL6) == VL9 .AND. At(".", VL6) ;
= 0 .AND. At(",", VL6) = 0)
get:todecpos()
elseif (Len(VL6) < VL9 .AND. At(".", ;
VL6) = 0 .AND. At(",", VL6) = 0)
gat1:= Val(VL6)
DevPos(nln[VL4], ncl[VL4])
DevOutPict(gat1, nmas[VL4])
SetPos(nln[VL4], Col() - 1)
endif
else
gat1:= Val(VL6)
DevPos(nln[VL4], ncl[VL4])
DevOutPict(gat1, nmas[VL4])
SetPos(nln[VL4], Col() - 1)
endif
endif
VL1:= iif(get:typeout(), .T., .F.)
endcase
end
if (VL2 == 5)
loop
endif
if (get:changed())
get:assign()
endif
if (VL4 = Len(nln))
if (get:postblock() != Nil .AND. VL2 != 5 .AND. ;
VL2 != 24)
if (!eval(get:postblock(), get))
loop
endif
endif
get:killfocus()
get:display()
break(Nil)
endif
get:killfocus()
if (get:postblock() != Nil .AND. VL2 != 5 .AND. VL2 ;
!= 24)
if (!eval(gnet:postblock(), get))
loop
endif
endif
VL4:= VL4 - iif(get:baddate(), 1, 0)
get:display()
VL4++
end
end sequence
return get:varget()