Exemplo de Editor
Microsiga Protheus 8.11
Exemplo de editor de diagramas.
#include "protheus.ch"// Editor BPMuser function dgeditor() local oWindow, oPanel, oMenubar, oEditor, oDocument, oBPMDoc, aDocs := {} local nGapX := 0, oGapY := 0, nDoc := 1 local oButton0, oButton1, oButton2, oButton3, oButton4, oButton5, oButton6, oButton7, oButton8, oButton9 local cFileName := " " public cBuffer := "" // Janela oWindow := tWindow():New( 10, 10, 400, 400, "Editor de Diagramas",,,,,,,,CLR_BLACK,CLR_WHITE,,,,,,,.T. ) // oMenubar := tMenubar():New(oWindow) // tMenuBar - util para MDI oPanel := tPanel():New(0, 0, "", oWindow,,,,CLR_BLACK ,CLR_WHITE, 20, 20) oPanel:Align := 3 // Editor oEditor := TDGEditor():New(oWindow) oEditor:Align := 5 // ALLCLIENT // Documento oBPMDoc := TDGBpmDoc():New(oEditor) nGapX := oBPMDoc:nHorizGap nGapY := oBPMDoc:nVertGap aAdd(aDocs, oBPMDoc) // Barra de Ferramentas @ 0, 20 SAY "File: " @ 0, 22 GET cFileName PICTURE "XXXXXXXXXX" @ 0, 30 SAY "Window:" @ 0, 34 GET nDoc PICTURE "999" oButton0 := tButton():New(0, 0, "New", oPanel, {|| TDGBpmDoc():New(oEditor)}, 50, 10,,,,.T.) oButton1 := tButton():New(0, 50, "Save", oPanel, {|| oEditor:GetDoc(nDoc):save(@cBuffer), saveBPM(cFileName) }, 50, 10,,,,.T.) oButton2 := tButton():New(0, 100, "Load", oPanel, {|| if(restoreBPM(cFileName), oEditor:loadDoc(@cBuffer), .f.)}, 50, 10,,,,.T.) oButton3 := tButton():New(10, 0, "ZoomIn", oPanel, {||oEditor:GetDoc(nDoc):ZoomIn()}, 50, 10,,,,.T.) oButton4 := tButton():New(10, 50, "ZoomOut", oPanel, {||oEditor:GetDoc(nDoc):ZoomOut()}, 50, 10,,,,.T.) oButton5 := tButton():New(10, 100, "Line", oPanel, {||oEditor:GetDoc(nDoc):addConnector(0)}, 50, 10,,,,.T.) oButton6 := tButton():New(10, 150, "Poly", oPanel, {||oEditor:GetDoc(nDoc):addConnector(1)}, 50, 10,,,,.T.) oButton7 := tButton():New(10, 200, "Shapes", oPanel, {||showshapes(oEditor:GetDoc(nDoc):GetShapes())}, 50, 10,,,,.T.) oButton8 := tButton():New(10, 250, "Connectors", oPanel, {||showconns(oEditor:GetDoc(nDoc):GetConnectors())}, 50, 10,,,,.T.) oButton9 := tButton():New(10, 300, "Show", oPanel, {|| oEditor:GetDoc(nDoc):ShowBoxes()}, 50, 10,,,,.T.) // Janela oWindow:Activate()return// Mostra shapes na consolefunction showshapes(aShapes) local x, nSize := len(aShapes) conout("Shapes") for x := 1 to nSize conout("Shape ["+str(x,2)+"]: "+aShapes[x]:cText) nextreturn// Mostra conectores na consolefunction showconns(aConns) local x, nSize := len(aConns) conout("Conectors") for x := 1 to nSize conout("Conn ["+str(x,2)+"]: "+str(aConns[x]:nX)) nextreturn
Nível 1 (Acesso Clientes)
Espanhol
,
Inglês
Visão Geral
Import HTML Content
Conteúdo das Ferramentas
Tarefas