Páginas filhas
  • Exemplo de Shape 02

Exemplo de Shape 02




Microsiga Protheus 8.11

Exemplo de shape 02.

#include "protheus.ch"#DEFINE DNORTH	0#DEFINE DEAST	1#DEFINE DSOUTH	2#DEFINE DWEAST	3// ***************************************************************************// TDGDecisao - Shape// ***************************************************************************class TDGDecisao from TDGShape	data bCond	data lRet        data nID        data nMyColor		method New(oControl) CONSTRUCTOR	method DrawShape(nWidth, nHeight)	method ConnectPoints(nWidth, nHeight)	method PointsDirection()	method OnClick(nWidth, nHeight)	method OnDblClick(nWidth, nHeight)	method OnRightClick(nWidth, nHeight)	method OnProperties()		method run()endclassmethod New(oControl) class TDGDecisao:New(oControl)		::nID := 0	::nMyColor := CLR_HGRAY	::lRet := .f.		::cText := "FALSE"	::nWidth := 100	::nHeight := 60returnmethod DrawShape(oPainter, nWidth, nHeight) class TDGDecisao	// Losango	oPainter:nBorderSize := 1	oPainter:nBorderStyle := 1	oPainter:nBackStyle := 1	oPainter:nBackColor := ::nMyColor	oPainter:DrawPoly( { {nWidth/2, 0}, ;						 {0, nHeight/2}, ;						 {nWidth/2, nHeight}, ;						 {nWidth, nHeight/2},  ;						 {nWidth/2, 0} } )returnmethod ConnectPoints(nWidth, nHeight) class TDGDecisao	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 TDGDecisao	local aPoints := {}	aAdd(aPoints, DNORTH)	aAdd(aPoints, DWEST)	aAdd(aPoints, DSOUTH)	aAdd(aPoints, DEAST)	return aPoints// Eventosmethod run() class TDGDecisao	local nX, aShapes	conout(::cText+" running...")	if(::lRet)		aShapes := ::GetDestShapes(3)	else		aShapes := ::GetDestShapes(4)	endif	for nX := 1 to len(aShapes)		aShapes[nX]:run()	nextreturnmethod OnProperties() class TDGDecisaoreturnmethod OnClick(nX, nY) class TDGDecisao	::lRet := !::lRet	::cText := if(::lRet, "TRUE", "FALSE")	::update()returnmethod OnDblClick(nX, nY) class TDGDecisaoreturnmethod OnRightClick(nX, nY) class TDGDecisaoreturn// ***************************************************************************// TDGDeciIcon - Shape Decisao Icon// ***************************************************************************class TDGDeciIcon from TDGShapeicon	method New(oControl) CONSTRUCTOR	method CreateShape(oDocument, nX, nY)endclassmethod New(oControl) class TDGDeciIcon:New(oControl)	::cText := "Decisão"	::cIcon := "decision.png"returnmethod CreateShape(oDocument, nX, nY) class TDGDeciIcon	local oShape	oShape := TDGDecisao():New(oDocument)	oShape:Update()return
Nível 1 (Acesso Clientes)
Espanhol , Inglês

  • Sem rótulos