Page 1 of 1
Antonio, por favor preciso muito disso! (resolvido !)
Posted: Thu Aug 23, 2007 8:04 pm
by AOKISANTOS
Antonio e amigos, preciso criar um timer que de tempos em tempos verifique a situacao e troque BMP de botoes BTNBMP, não estou conseguindo:
local obtn
define window oWndc from 0,0 TO 25,70 MDICHILD OF oWnd
define timer otimesa of owndc interval 5000 action(trocabmp(obtn))
@ 10,20 BTNBMP oBtn resource "FOOD2" TOP SIZE 60,60 OF oWndc
ACTIVATE WINDOW oWndc on inti(otimesa:activate())
************************
function trocabmp(obtn)
************************
obtn:loadbitmap(getresources(),"LUPA")
obtn:refresh()
return(.t.)
Esta retornando erro no refresh e sem refresh não troca imagem.
Fique com Deus
Grato
Aoki
Posted: Thu Aug 23, 2007 8:38 pm
by Antonio Linares
Crea el botón antes de crear el timer:
@ 10,20 BTNBMP oBtn resource "FOOD2" TOP SIZE 60,60 OF oWndc
define timer otimesa of owndc interval 5000 action(trocabmp(obtn))
Posted: Thu Aug 23, 2007 8:59 pm
by AOKISANTOS
Antonio, não resolveu... segue meu ERROR.LOG e PRG:
Application
===========
Path and name: C:\DBF\sgs.exe (32 bits)
Size: 3,464,192 bytes
Time from start: 0 hours 0 mins 17 secs
Error occurred at: 23/08/2007, 18:01:19
Error description: Error BASE/1004 Message not found: TBTNBMP:LOADBIMTAP
Stack Calls
===========
Called from: => TBTNBMP:ERROR(179)
Called from: tobject.prg => (b)HBOBJECT:HBOBJECT(105)
Called from: => TBTNBMP:MSGNOTFOUND(0)
Called from: BTNBMP.PRG => TBTNBMP:LOADBIMTAP(167)
Called from: mesas.prg => VERSITUAMESAS(59)
Called from: mesas.prg => (b)SELECIONAMESA(43)
Called from: TIMER.PRG => TIMEREVENT(0)
Called from: window.prg => (b)TWINDOW:TWINDOW(554)
Called from: window.prg => TMDICHILD:TIMER(0)
Called from: window.prg => TWINDOW:HANDLEEVENT(0)
Called from: MDICHILD.PRG => TMDICHILD:HANDLEEVENT(0)
Called from: window.prg => _FWH(3165)
Called from: => WINRUN(0)
Called from: window.prg => TMDIFRAME:ACTIVATE(883)
Called from: sgs.PRG => MAIN(219)
#include "FiveWin.ch"
********************************************************
FUNCTION SelecionaMesa(nmesa,cmod,nMaxMesa,off,cDescTipo)
********************************************************
LOCAL oScrWnd,i,j,contamesas:=0,osay,oBt2,cfupla,coImg,otimesa,Mobtn[nMaxMesa], aMesasOcup := {},aMesasPFech := {}
SituacaoMesas(cMod,nMaxMesa,@aMesasOcup,@aMesasPFech)
define window oWndc from 0, 0 TO 25, 70 ;
title "Controle de Mesas" MDICHILD OF oWnd vscroll icon oico COLOR EMP_MCOR,EMP_MCOR NOICONIZE
oWndc:maximize()
for i := 1 to 500
for j := 1 to 10
contamesas++
if contamesas<=nMaxMesa
if empty(ascan(aMesasOcup,contamesas))
@ (((i+.1) * 70) - 70), ((j * 76) - 60) BTNBMP MoBtn[contamesas] resource "FOOD2","YES" TOP SIZE 60, 60 OF oWndc noborder
else
@ (((i+.1) * 70) - 70), ((j * 76) - 60) BTNBMP MoBtn[contamesas] resource "FOOD1","YES" TOP SIZE 60, 60 OF oWndc
endif
MoBtn[contamesas]:settext("Mesa: "+alltrim(str(contamesas)))
else
exit
endif
next
next
if emp_cors
IF ! FILE(ALLTRIM(emp_plan))
cfupla:=SI1+"sgs.jpg"
ELSE
cfupla:=emp_plan
ENDIF
coImg := TImage():Define( , cfupla )
oWndc:bPainted := {|hDC| PalBmpDraw( hDC, 0, 0,coImg:hBitmap,, oWndc:nWidth, oWndc:nHeight, , .T.) }
endif
define timer otimesa of owndc interval 10000 action(VERSITUAMESAS(nMaxMesa,cmod,Mobtn))
otimesa:activate()
ACTIVATE WINDOW oWndc MAXIMIZED on init(TScrWnd():New( oWndc, 1, nMaxMesa, 1, 70 ));
valid(otimesa:deactivate(),oWndc:=NIL,.t.)
return !empty(nMesa)
*******************************************
FUNCTION VERSITUAMESAS(nMaxMesa,cmod,Mobtn)
*******************************************
mobtn[1]:loadbimtap(getresources(),"LUPA")
mobtn[1]:refresh()
RETURN(.T.)
Posted: Thu Aug 23, 2007 9:05 pm
by Antonio Linares
Que error da ?
Posted: Fri Aug 24, 2007 11:09 am
by AOKISANTOS
Antonio, Bom dia, o erro já esta postado acima e esta ocorrendo nesta linha:
moBtn[1]:loadbitmap(getresources(),"LUPA") <- erro
moBtn[1]:refresh()
Application
===========
Path and name: C:\DBF\sgs.exe (32 bits)
Size: 3,464,192 bytes
Time from start: 0 hours 0 mins 8 secs
Error occurred at: 24/08/2007, 08:05:47
Error description: Error BASE/1004 Message not found: TBTNBMP:LOADBITMAP
Stack Calls
===========
Called from: => TBTNBMP:ERROR(179)
Called from: tobject.prg => (b)HBOBJECT:HBOBJECT(105)
Called from: => TBTNBMP:MSGNOTFOUND(0)
Called from: BTNBMP.PRG => TBTNBMP:LOADBITMAP(167)
Called from: mesas.prg => VERSITUAMESAS(68)
Called from: mesas.prg => (b)SELECIONAMESA(45)
Called from: TIMER.PRG => TIMEREVENT(0)
Called from: window.prg => (b)TWINDOW:TWINDOW(554)
Called from: window.prg => TMDICHILD:TIMER(0)
Called from: window.prg => TWINDOW:HANDLEEVENT(0)
Called from: MDICHILD.PRG => TMDICHILD:HANDLEEVENT(0)
Called from: window.prg => _FWH(3165)
gracias Antonio...
Aoki
Posted: Fri Aug 24, 2007 11:28 am
by AOKISANTOS
Antonio, muito obrigado!
Resolvi usando loadbitmaps("RECURSO")
Muito obrigado e Deus te abençoe!
Aoki