Exemplo de Shape 01




Microsiga Protheus 8.11

Exemplo de shape.

#include "protheus.ch"#DEFINE DNORTH	0#DEFINE DEAST	1#DEFINE DSOUTH	2#DEFINE DWEST	3// ***************************************************************************// TDGProcesso - Shape// ***************************************************************************class TDGProcesso from TDGShape	data nNumero	data cDesc        data nMyColor        data nID 		method New(oControl) CONSTRUCTOR	method DrawShape(nWidth, nHeight)	method ConnectPoints(nWidth, nHeight)	method PointsDirection()	method OnClick(nX, nY)	method OnDblClick(nX, nY)	method OnRightClick(nX, nY)	method OnProperties()	method run()endclassmethod New(oControl) class TDGProcesso:New(oControl)	::nNumero := 7	::cDesc := "Proc desc!"	::nID := 0	::nMyColor := CLR_HCYAN		::cText := "Processo"	::nWidth := 100	::nHeight := 60	::nBorderColor := CLR_BLACK	::nBorderSize := 1	::nBorderStyle := 1	::nBackColor := CLR_WHITE	::nBackStyle := 1returnmethod DrawShape(oPainter, nWidth, nHeight) class TDGProcesso	// Inicio	oPainter:nBorderColor := CLR_BLACK	oPainter:nBorderSize := 1	oPainter:nBorderStyle := 1	oPainter:nBackStyle := 1		// Retangulo	oPainter:nBackColor := ::nMyColor	oPainter:DrawRect(0, 0, nWidth, nHeight)	returnmethod ConnectPoints(nWidth, nHeight) class TDGProcesso	local aPoints := {}	aAdd(aPoints, {nWidth/2, 0})	aAdd(aPoints, {0, nHeight/2})	aAdd(aPoints, {nWidth/2, nHeight})	aAdd(aPoints, {nWidth, nHeight/2})	return aPointsmethod PointsDirection() class TDGProcesso	local aPoints := {}	aAdd(aPoints, DNORTH)	aAdd(aPoints, DWEST)	aAdd(aPoints, DSOUTH)	aAdd(aPoints, DEAST)	return aPoints// Eventosmethod OnProperties() class TDGProcesso	msgstop("EDITOR: Onde está azul vai ficar amarelo.")	::nMyColor := CLR_YELLOW	::Update()	msgstop("EDITOR: Amarelo? Properties OK.")returnmethod OnClick(nX, nY) class TDGProcesso	msgstop("VISUALIZADOR: OnClick ok. X:"+str(nX)+" Y:"+str(nY))returnmethod OnDblClick(nX, nY) class TDGProcesso	msgstop("VISUALIZADOR: OnDblClick ok. X:"+str(nX)+" Y:"+str(nY))returnmethod OnRightClick(nX, nY) class TDGProcesso	msgstop("VISUALIZADOR: OnRightClick ok. X:"+str(nX)+" Y:"+str(nY))returnmethod run() class TDGProcesso	local nX, aShapes := ::GetDestShapes()		conout(::cText+" running...")	for nX := 1 to len(aShapes)		aShapes[nX]:run()	nextreturn// ***************************************************************************// TDGProcesso ICON// ***************************************************************************class TDGProcIcon from TDGShapeicon	method New(oControl) CONSTRUCTOR	method CreateShape(oDocument, nX, nY)endclassmethod New(oControl) class TDGProcIcon:New(oControl)	::cText := "Processo"	::cIcon := "process.png"returnmethod CreateShape(oDocument, nX, nY) class TDGProcIcon	local oShape	oShape := TDGProcesso():New(oDocument)	oShape:SetPosition(nX, nY)	oShape:Update()return
Nível 1 (Acesso Clientes)
Espanhol , Inglês

  • Sem rótulos