DASHBOARD WITH DRAWBOX IN MAIN FORM WITH RUN-TIME UPDATE

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
jairpinho
Posts: 420
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Contact:

DASHBOARD WITH DRAWBOX IN MAIN FORM WITH RUN-TIME UPDATE

Post by jairpinho »

Hello, people, I need to update data at runtime in the main window or in other windows, but you must update at runtime as the data is updated as if it were a summary dashboard. I found some examples that work very well but it doesn't update at runtime and it only works with the window's onpaint
Drawbox.zip
project in hmg 3.4.4
(5.23 KiB) Downloaded 132 times

Code: Select all


*******************************************************************************
* PROGRAMA: Demo ON PAINT event
* LENGUAJE: HMG
* FECHA:    Setiembre 2012
* AUTOR:    Dr. CLAUDIO SOTO
* PAIS:     URUGUAY
* E-MAIL:   srvet@adinet.com.uy
* BLOG:     http://srvet.blogspot.com
*******************************************************************************


#include "hmg.ch"
#include "minigui.ch"
#include "i_Color2.ch"
DECLARE WINDOW Win1
FUNCTION MAIN
//Local aSer:={ {20 }, {50 }, {2 } , {10 }} 

SET CODEPAGE TO PORTUGUESE
	IF !IsWindowDefined(Win1)
	   Load WINDOW Win1
	   CENTER WINDOW Win1
	   ACTIVATE WINDOW Win1
	  ELSE
  		Center	WINDOW  win1
		RESTORE 	WINDOW 	win1
		Return
	endif

RETURN Nil



PROCEDURE GraphsStatus() 
Local nval1 := win1.text_2.value
Local aSerieValues_PSM := {}
aSerieValues_PSM	:={	{	nval1	,30		,40		,50		, 60 },;
							{10						,12		,28		,36		, 70 },;
							{22						,55		,18		,4		, 10 },;
							{10						,20		,40		,11 	, 20};
						}
UpdateGraph ( GetFormHandle ("win1") )

return


PROCEDURE HMG_DrawBOXGraphs() 
					

	DrawBox_DASH("win1",;
	2 /*nTipo*/,;
	win1.text_1.value /*cTextVal*/,;
	"PSM ABERTOS"/*cTextTag*/,;
	120/*nLineStart_Pos*/,;
	80 /*nLine_BoxSizeHeight*/,;
	20/*nCol_Start*/,;
	200/*nCol_BoxSizeWidth*/,;
	32 /*nFonteSizeValor*/,;
	1/*nTipoFonte*/ ,;
	14 /*nFonteSizeTag*/,;
	2/*nTipoFonteTag*/ ,; 
	7 /*nBorderSize*/,;
	25/*nRaioBorder*/,;
	BORDA2/*aColorBorder*/,;
	ABERTO/*aColor_BK*/,;
	.f./*lTagBK*/,;
	nil/*aColorTagBK*/;
	)  
	
	DrawBox_DASH("win1",;
	2 /*nTipo*/,;
	"18"/*cTextVal*/,;
	"PSM ATENDIDOS"/*cTextTag*/,;
	220/*nLineStart_Pos*/,;
	80 /*nLine_BoxSizeHeight*/,;
	20/*nCol_Start*/,;
	200/*nCol_BoxSizeWidth*/,;
	32 /*nFonteSizeValor*/,;
	1/*nTipoFonte*/ ,;
	14 /*nFonteSizeTag*/,;
	2/*nTipoFonteTag*/ ,; 
	7 /*nBorderSize*/,;
	25/*nRaioBorder*/,;
	BORDA2/*aColorBorder*/,;
	FINALIZADO/*aColor_BK*/,;
	.f./*lTagBK*/,;
	nil/*aColorTagBK*/;
	)  	


	DrawBox_DASH("win1",;
	2 /*nTipo*/,;
	"18"/*cTextVal*/,;
	"PSM ATENDIMENTO"/*cTextTag*/,;
	120/*nLineStart_Pos*/,;
	80 /*nLine_BoxSizeHeight*/,;
	240/*nCol_Start_Pos*/,;
	200/*nCol_BoxSizeWidth*/,;
	32 /*nFonteSizeValor*/,;
	1/*nTipoFonte*/ ,;
	14 /*nFonteSizeTag*/,;
	2/*nTipoFonteTag*/ ,; 
	7 /*nBorderSize*/,;
	25/*nRaioBorder*/,;
	BORDA2/*aColorBorder*/,;
	ATENDIMENTO/*aColor_BK*/,;
	.f./*lTagBK*/,;
	nil/*aColorTagBK*/;
	)  	


	DrawBox_DASH("win1",;
	2 /*nTipo*/,;
	"18"/*cTextVal*/,;
	"PSM CANCELADOS"/*cTextTag*/,;
	220/*nLineStart_Pos*/,;
	80 /*nLine_BoxSizeHeight*/,;
	240/*nCol_Start_Pos*/,;
	200/*nCol_BoxSizeWidth*/,;
	32 /*nFonteSizeValor*/,;
	1/*nTipoFonte*/ ,;
	14 /*nFonteSizeTag*/,;
	2/*nTipoFonteTag*/ ,; 
	7 /*nBorderSize*/,;
	25/*nRaioBorder*/,;
	BORDA2/*aColorBorder*/,;
	CANCELADO/*aColor_BK*/,;
	.f./*lTagBK*/,;
	nil/*aColorTagBK*/;
	)  	


***********************///// ORDEM DE SERVICOS///////***************

	DrawBox_DASH("win1",;
	2 /*nTipo*/,;
	"22"/*cTextVal*/,;
	"PSM ABERTOS"/*cTextTag*/,;
	520/*nLineStart_Pos*/,;
	80 /*nLine_BoxSizeHeight*/,;
	20/*nCol_Start*/,;
	200/*nCol_BoxSizeWidth*/,;
	32 /*nFonteSizeValor*/,;
	1/*nTipoFonte*/ ,;
	14 /*nFonteSizeTag*/,;
	2/*nTipoFonteTag*/ ,; 
	7 /*nBorderSize*/,;
	25/*nRaioBorder*/,;
	BORDA2/*aColorBorder*/,;
	ABERTO/*aColor_BK*/,;
	.f./*lTagBK*/,;
	nil/*aColorTagBK*/;
	)  
	
	DrawBox_DASH("win1",;
	2 /*nTipo*/,;
	"18"/*cTextVal*/,;
	"PSM ATENDIDOS"/*cTextTag*/,;
	620/*nLineStart_Pos*/,;
	80 /*nLine_BoxSizeHeight*/,;
	20/*nCol_Start*/,;
	200/*nCol_BoxSizeWidth*/,;
	32 /*nFonteSizeValor*/,;
	1/*nTipoFonte*/ ,;
	14 /*nFonteSizeTag*/,;
	2/*nTipoFonteTag*/ ,; 
	7 /*nBorderSize*/,;
	25/*nRaioBorder*/,;
	BORDA2/*aColorBorder*/,;
	FINALIZADO/*aColor_BK*/,;
	.f./*lTagBK*/,;
	nil/*aColorTagBK*/;
	)  	


	DrawBox_DASH("win1",;
	2 /*nTipo*/,;
	"18"/*cTextVal*/,;
	"PSM ATENDIMENTO"/*cTextTag*/,;
	520/*nLineStart_Pos*/,;
	80 /*nLine_BoxSizeHeight*/,;
	240/*nCol_Start_Pos*/,;
	200/*nCol_BoxSizeWidth*/,;
	32 /*nFonteSizeValor*/,;
	1/*nTipoFonte*/ ,;
	14 /*nFonteSizeTag*/,;
	2/*nTipoFonteTag*/ ,; 
	7 /*nBorderSize*/,;
	25/*nRaioBorder*/,;
	BORDA2/*aColorBorder*/,;
	ATENDIMENTO/*aColor_BK*/,;
	.f./*lTagBK*/,;
	nil/*aColorTagBK*/;
	)  	


	DrawBox_DASH("win1",;
	2 /*nTipo*/,;
	"18"/*cTextVal*/,;
	"PSM CANCELADOS"/*cTextTag*/,;
	620/*nLineStart_Pos*/,;
	80 /*nLine_BoxSizeHeight*/,;
	240/*nCol_Start_Pos*/,;
	200/*nCol_BoxSizeWidth*/,;
	32 /*nFonteSizeValor*/,;
	1/*nTipoFonte*/ ,;
	14 /*nFonteSizeTag*/,;
	2/*nTipoFonteTag*/ ,; 
	7 /*nBorderSize*/,;
	25/*nRaioBorder*/,;
	BORDA2/*aColorBorder*/,;
	CANCELADO/*aColor_BK*/,;
	.f./*lTagBK*/,;
	nil/*aColorTagBK*/;
	)  	




RETURN

PROCEDURE DrawBox_DASH(cForm,nTipo,cTextVal,cTextTag,nLineStart,nLineEnd,nCol_Start,nCol_End,nFonteSize,nTipoFonte,nFonteSizeTag,nTipoFonteTag,nBorderSize,nRaioBorder,aColorBorder,aColor_BK,lTagBK,aColorTagBK)    
LOCAL Width1, Height1
LOCAL hDC1, BTstruct1
LOCAL Alpha := 50
LOCAL cText
Local cFonteValor := ""
Local cFonteTag := ""

 if nTipoFonte == 1 
	cFonteValor := "Open Sans"
 elseif nTipoFonte == 2
	cFonteValor := "Arial"
 elseif nTipoFonte == 3
 
 else
 
 endif
 
 
 if nTipoFonteTag == 1 
	cFonteTag := "Open Sans"
 elseif nTipoFonteTag == 2
	cFonteTag := "Arial"
 elseif nTipoFonteTag == 3
 
 else
 
 endif


   Width1  := BT_ClientAreaWidth  (cForm)
   Height1 := BT_ClientAreaHeight (cForm)

    hDC1 = BT_CreateDC (cForm, BT_HDC_ALLCLIENTAREA, @BTstruct1)
		nTypeText1  := BT_TEXT_TRANSPARENT + BT_TEXT_BOLD 
		nTypeText2  := BT_TEXT_BOLD 

        // nAlingText := BT_TEXT_LEFT + BT_TEXT_TOP
		 nAlingText := BT_TEXT_CENTER //+ BT_TEXT_TOP
		 nAlingText2 := BT_TEXT_CENTER + BT_TEXT_BASELINE //+ BT_TEXT_BOTTOM
		 
		 if nTipo = 1 
			BT_DrawFillRoundRect (hDC1,nLineStart, nCol_Start,nCol_End ,nLineEnd , nRaioBorder, nRaioBorder, ORANGE, RED, nBorderSize)
			BT_DrawText (hDC1, (nLineEnd /2) + nLineStart + (nFonteSize/2)/*pos linha*/ , (nCol_End / 2 ) +  nCol_Start /*pos col*/ , cTextVal, cFonteValor, nFonteSize, BLACK, if(lTagBK,aColorTagBK,nil) , if(lTagBK,nTypeText2,nTypeText1) , nAlingText2)
			//BT_DeleteDC (BTstruct1)
		 endif
		 
		 if nTipo = 2 
			 BT_DrawFillRoundRect (hDC1, nLineStart, nCol_Start, nCol_End, nLineEnd, nRaioBorder, nRaioBorder, aColor_BK, aColorBorder, nBorderSize)
			 BT_DrawText (hDC1, (nLineStart+nBorderSize) , (nCol_End / 2 ) +  nCol_Start /*pos col*/ , cTextTag, cFonteTag, nFonteSizeTag, BLACK,if(lTagBK,aColorTagBK,nil) , if(lTagBK,nTypeText2,nTypeText1), nAlingText)
			 BT_DrawText (hDC1, nLineEnd  + (nLineStart-(nBorderSize*2)) /*pos linha*/  , (nCol_End / 2 ) +  nCol_Start /*pos col*/ , cTextVal, cFonteValor, nFonteSize,BLACK,  ,nTypeText1  , nAlingText2)
			// BT_DeleteDC (BTstruct1)
		 endif
		 
		 if nTipo = 3 
			/*
			 BT_DrawFillRoundRect (hDC1, 400, 50, 300, 100, nRaioBorder, nRaioBorder, ORANGE, RED, nBorderSize)
			 BT_DrawText (hDC1, (400+(nBorderSize/2))-16 , 50+150, "PSM ABERTOS", "Comic Sans MS", nFonteSize, BLACK,if(lTagBK,aColorTagBK,nil) , if(lTagBK,nTypeText2,nTypeText1), nAlingText)
			 BT_DrawText (hDC1, (450+(nBorderSize/2))-32 , 50+150, "1500", "Comic Sans MS", nFonteSize, BLACK, , nTypeText1, nAlingText)		 
			 BT_DeleteDC (BTstruct1)
			*/
		 endif
		 
		 /*
		 if nTipo = 1 
			BT_DrawFillRoundRect (hDC1,050, 50, 300, 100, 10, 10, ORANGE, RED, 5)
			BT_DrawText (hDC1, (100+(5/2))-32 , 50+150, "1500", "Comic Sans MS", 32, BLACK, , nTypeText2, nAlingText)
		 endif
		 
		 if nTipo = 2 
			 BT_DrawFillRoundRect (hDC1, 200, 50, 300, 100, 10, 10, ORANGE, RED, 5)
			 BT_DrawText (hDC1, (200+5) , 50+150, "PSM ABERTOS", "Comic Sans MS", 16, BLACK, , nTypeText1, nAlingText)
			 BT_DrawText (hDC1, 300-(5*2) , 50+150, "1500", "Comic Sans MS", 40, BLACK, , nTypeText2, nAlingText2)
		 endif
		 
		 if nTipo = 3 
			 BT_DrawFillRoundRect (hDC1, 400, 50, 300, 100, 10, 10, ORANGE, RED, 5)
			 BT_DrawText (hDC1, (400+(5/2))-16 , 50+150, "PSM ABERTOS", "Comic Sans MS", 16, BLACK, , nTypeText1, nAlingText)
			 BT_DrawText (hDC1, (450+(5/2))-32 , 50+150, "1500", "Comic Sans MS", 32, BLACK, , nTypeText2, nAlingText)		 
			 BT_DeleteDC (BTstruct1)
		 endif		 
		 */
		 
RETURN





Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br
User avatar
AUGE_OHR
Posts: 2093
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: DASHBOARD WITH DRAWBOX IN MAIN FORM WITH RUN-TIME UPDATE

Post by AUGE_OHR »

hi,

instead of

Code: Select all

* UpdateGraph ( GetFormHandle ("win1") )
use

Code: Select all

INVALIDATERECT( GetFormHandle ("win1") )
have fun
Jimmy
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: DASHBOARD WITH DRAWBOX IN MAIN FORM WITH RUN-TIME UPDATE

Post by andyglezl »

Hola
Es solo una idea, me base en lo que quieres hacer, no como lo quieres programar.
*--------------------------------------------------------------------------------------------------------
Hello
It's just an idea, I base it on what you want to do, not how you want to program it.
Attachments
DB_Blue(2).jpg
DB_Blue(2).jpg (133.58 KiB) Viewed 8061 times
demodashb (2).zip
(1.77 MiB) Downloaded 110 times
DemoDashB.jpg
DemoDashB.jpg (112.03 KiB) Viewed 8167 times
DemoDashB.zip
(1.85 MiB) Downloaded 123 times
Andrés González López
Desde Guadalajara, Jalisco. México.
Post Reply