Page 1 of 2

Disappearing Bos Taurus Image

Posted: Mon Aug 28, 2017 12:00 am
by bluebird
Dear patient mentors

After succeeding to use BT to draw my images in a window on my screen, I find that every time I move a slider, all
of the BT parts disappear from the window, leaving the HMG parts in tact.

Is this normal? Is there something I have to do to retain the BT part of the image in tact until I really want to
tell it to clear?



Thanks

Re: Disappearing Bos Taurus Image

Posted: Mon Aug 28, 2017 1:21 am
by luisvasquezcl
Dear, upload demo please

Re: Disappearing Bos Taurus Image

Posted: Mon Aug 28, 2017 9:56 am
by edk
A Similar issue applies to tab switching. The difference is that after switching to another tab the graphic remains.
Every time when tabs are switched, wipe the screen ("ERASE WINDOW wName") and re-draw the graphic.

Code: Select all


#include "hmg.ch"

FUNCTION Main()

LOCAL wName:='wKonfiguracja'

DEFINE WINDOW &wName AT 0 , 0 WIDTH 800 HEIGHT 533;
	TITLE "Konfiguracja" MAIN;
	NOMAXIMIZE;
	NOMINIMIZE;
	NOSIZE;
	ICON Nil;
	ON INIT OnTop(ThisWindow.Name);
	BACKCOLOR Nil


	DEFINE TAB tab1 AT 10 , 20 WIDTH 750 HEIGHT 430 VALUE 1 TOOLTIP "Konfiguracja" HOTTRACK;
    	ON CHANGE IF(This.value=3, paint_arrows(wName), erase_arrows(wName))
    	
    	        PAGE "&Podstawowe parametry "

	        DEFINE TEXTBOX adres
                ROW    30
                COL    90
                WIDTH  650
                HEIGHT 20
                TOOLTIP "Adres firmy"
                ONCHANGE Nil
                ONGOTFOCUS Nil
                ONLOSTFOCUS Nil
                FONTBOLD .F.
                FONTITALIC .F.
                FONTUNDERLINE .F.
                FONTSTRIKEOUT .F.
                ONENTER Nil
                HELPID Nil
                TABSTOP .T.
                VISIBLE .T.
                READONLY .F.
                RIGHTALIGN .F.
                CASECONVERT NONE
                MAXLENGTH 65
                INPUTMASK Nil
                FORMAT Nil
                VALUE "Adres"
            END TEXTBOX

        END PAGE 

        PAGE "&Numeracja"
        
                DEFINE TEXTBOX N_p_nrf
                ROW    40
                COL    240
                WIDTH  70
                HEIGHT 20
                TOOLTIP ""
                ONCHANGE Nil
                ONGOTFOCUS Nil
                ONLOSTFOCUS Nil
                FONTBOLD .F.
                FONTITALIC .F.
                FONTUNDERLINE .F.
                FONTSTRIKEOUT .F.
                ONENTER Nil
                HELPID Nil
                TABSTOP .T.
                VISIBLE .T.
                READONLY .F.
                RIGHTALIGN .F.
               CASECONVERT NONE
                MAXLENGTH 6
               INPUTMASK Nil
                FORMAT Nil
                NUMERIC .T. 
                VALUE '100'
            END TEXTBOX
        END PAGE 

        PAGE "&Logo"
        
        END PAGE 

	END TAB
END WINDOW
Center window &wName
Activate window &wName

RETURN   	
****************************************************************
Function paint_arrows(wName)
erase_arrows(wName)

//grafika współrzednych
//punkt
DRAW LINE IN WINDOW &wName AT 240,70 ;
	TO 240,70 ;
	PENCOLOR {0,0,0} ; 
	PENWIDTH 5

//wektor pionowy |
DRAW LINE IN WINDOW &wName AT 240,70 ;
	TO 390,70 ;
	PENCOLOR {0,0,0} ; 
	PENWIDTH 1

//grot V 
DRAW PIE IN WINDOW &wName AT 375,55 ;
	TO 405,85 ;
	FROM RADIAL 380, 73 ;
	TO RADIAL 380, 67 ;
	PENCOLOR {0,0,0} ; 
	PENWIDTH 1 ;
	FILLCOLOR {0,0,0}


//wektor poziomy -
DRAW LINE IN WINDOW &wName AT 240,70 ;
	TO 240,215 ;
	PENCOLOR {0,0,0} ; 
	PENWIDTH 1

//grot > 
DRAW PIE IN WINDOW &wName AT 225,200 ;
	TO 255,230 ;
	FROM RADIAL 237, 205 ;
	TO RADIAL 243, 205 ;
	PENCOLOR {0,0,0} ; 
	PENWIDTH 1 ;
	FILLCOLOR {0,0,0}


//grafika rozmiaru okna
//wektor pionowy |
DRAW LINE IN WINDOW &wName AT 240,280 ;
	TO 390,280 ;
	PENCOLOR {0,0,0} ; 
	PENWIDTH 1


//grot V 
DRAW PIE IN WINDOW &wName AT 375,265 ;
	TO 405,295 ;
	FROM RADIAL 380, 283 ;
	TO RADIAL 380, 277 ;
	PENCOLOR {0,0,0} ; 
	PENWIDTH 1 ;
	FILLCOLOR {0,0,0}

//wektor poziomy -
DRAW LINE IN WINDOW &wName AT 240,280 ;
	TO 240,430 ;
	PENCOLOR {0,0,0} ; 
	PENWIDTH 1

//grot > 
DRAW PIE IN WINDOW &wName AT 225,415 ;
	TO 255,445 ;
	FROM RADIAL 237, 420 ;
	TO RADIAL 243, 420 ;
	PENCOLOR {0,0,0} ; 
	PENWIDTH 1 ;
	FILLCOLOR {0,0,0}

	
Return Nil
****************************************************************
Function Erase_arrows(wName)
ERASE WINDOW &wName
RETURN Nil
****************************************************************
    	
Function OnTop(cForm)
Local hWnd := GetFormHandle( cForm )
SetForeGroundWindow( hWnd )
Return Nil
    	
    	

Re: Disappearing Bos Taurus Image

Posted: Mon Aug 28, 2017 12:49 pm
by luisvasquezcl
Dear,
in the on paint event of the window call the function OnTop

Estimado,
en el evento onpaint de la ventana llame la funcion OnTop

Re: Disappearing Bos Taurus Image

Posted: Mon Aug 28, 2017 3:08 pm
by bluebird
I added two drawlines to the base screen just before "define tab tab1, then built the exe file.
When you tab it erases my two red lines, which is like the problem I have with my own code when I
touch the virtual screen sliders.

Why do these 2 red lines disappear? I did not ask them to :)

Thanks



edk wrote: Mon Aug 28, 2017 9:56 am A Similar issue applies to tab switching. The difference is that after switching to another tab the graphic remains.
Every time when tabs are switched, wipe the screen ("ERASE WINDOW wName") and re-draw the graphic.

Code: Select all


#include "hmg.ch"

FUNCTION Main()

LOCAL wName:='wKonfiguracja'

DEFINE WINDOW &wName AT 0 , 0 WIDTH 800 HEIGHT 533;
	TITLE "Konfiguracja" MAIN;
	NOMAXIMIZE;
	NOMINIMIZE;
	NOSIZE;
	ICON Nil;
	ON INIT OnTop(ThisWindow.Name);
	BACKCOLOR Nil
DEFINE WINDOW &wName AT 0 , 0 WIDTH 800 HEIGHT 533;
	TITLE "Konfiguracja" MAIN;
	NOMAXIMIZE;
	NOMINIMIZE;
	NOSIZE;
	ICON Nil;
	ON INIT OnTop(ThisWindow.Name);
	BACKCOLOR Nil

	DRAW LINE IN WINDOW &wName AT 0,100 TO 500,100 PENCOLOR RED PENWIDTH 2 //Y axis
        DRAW LINE IN WINDOW &wName AT 500,100 TO 500,600 PENCOLOR RED PENWIDTH 2 //X axis


	DEFINE TAB tab1 AT 10 , 20 WIDTH 750 HEIGHT 430 VALUE 1 TOOLTIP "Konfiguracja" HOTTRACK;
    	ON CHANGE IF(This.value=3, paint_arrows(wName), erase_arrows(wName))
    	
    	        PAGE "&Podstawowe parametry "

	        DEFINE TEXTBOX adres
                ROW    30
                COL    90
                WIDTH  650
                HEIGHT 20
                TOOLTIP "Adres firmy"
                ONCHANGE Nil
                ONGOTFOCUS Nil
                ONLOSTFOCUS Nil
                FONTBOLD .F.
                FONTITALIC .F.
                FONTUNDERLINE .F.
                FONTSTRIKEOUT .F.
                ONENTER Nil
                HELPID Nil
                TABSTOP .T.
                VISIBLE .T.
                READONLY .F.
                RIGHTALIGN .F.
                CASECONVERT NONE
                MAXLENGTH 65
                INPUTMASK Nil
                FORMAT Nil
                VALUE "Adres"
            END TEXTBOX

        END PAGE 

        PAGE "&Numeracja"
        
                DEFINE TEXTBOX N_p_nrf
                ROW    40
                COL    240
                WIDTH  70
                HEIGHT 20
                TOOLTIP ""
                ONCHANGE Nil
                ONGOTFOCUS Nil
                ONLOSTFOCUS Nil
                FONTBOLD .F.
                FONTITALIC .F.
                FONTUNDERLINE .F.
                FONTSTRIKEOUT .F.
                ONENTER Nil
                HELPID Nil
                TABSTOP .T.
                VISIBLE .T.
                READONLY .F.
                RIGHTALIGN .F.
               CASECONVERT NONE
                MAXLENGTH 6
               INPUTMASK Nil
                FORMAT Nil
                NUMERIC .T. 
                VALUE '100'
            END TEXTBOX
        END PAGE 

        PAGE "&Logo"
        
        END PAGE 

	END TAB
END WINDOW
Center window &wName
Activate window &wName

RETURN   	
****************************************************************
Function paint_arrows(wName)
erase_arrows(wName)

//grafika współrzednych
//punkt
DRAW LINE IN WINDOW &wName AT 240,70 ;
	TO 240,70 ;
	PENCOLOR {0,0,0} ; 
	PENWIDTH 5

//wektor pionowy |
DRAW LINE IN WINDOW &wName AT 240,70 ;
	TO 390,70 ;
	PENCOLOR {0,0,0} ; 
	PENWIDTH 1

//grot V 
DRAW PIE IN WINDOW &wName AT 375,55 ;
	TO 405,85 ;
	FROM RADIAL 380, 73 ;
	TO RADIAL 380, 67 ;
	PENCOLOR {0,0,0} ; 
	PENWIDTH 1 ;
	FILLCOLOR {0,0,0}


//wektor poziomy -
DRAW LINE IN WINDOW &wName AT 240,70 ;
	TO 240,215 ;
	PENCOLOR {0,0,0} ; 
	PENWIDTH 1

//grot > 
DRAW PIE IN WINDOW &wName AT 225,200 ;
	TO 255,230 ;
	FROM RADIAL 237, 205 ;
	TO RADIAL 243, 205 ;
	PENCOLOR {0,0,0} ; 
	PENWIDTH 1 ;
	FILLCOLOR {0,0,0}


//grafika rozmiaru okna
//wektor pionowy |
DRAW LINE IN WINDOW &wName AT 240,280 ;
	TO 390,280 ;
	PENCOLOR {0,0,0} ; 
	PENWIDTH 1


//grot V 
DRAW PIE IN WINDOW &wName AT 375,265 ;
	TO 405,295 ;
	FROM RADIAL 380, 283 ;
	TO RADIAL 380, 277 ;
	PENCOLOR {0,0,0} ; 
	PENWIDTH 1 ;
	FILLCOLOR {0,0,0}

//wektor poziomy -
DRAW LINE IN WINDOW &wName AT 240,280 ;
	TO 240,430 ;
	PENCOLOR {0,0,0} ; 
	PENWIDTH 1

//grot > 
DRAW PIE IN WINDOW &wName AT 225,415 ;
	TO 255,445 ;
	FROM RADIAL 237, 420 ;
	TO RADIAL 243, 420 ;
	PENCOLOR {0,0,0} ; 
	PENWIDTH 1 ;
	FILLCOLOR {0,0,0}

	
Return Nil
****************************************************************
Function Erase_arrows(wName)
ERASE WINDOW &wName
RETURN Nil
****************************************************************
    	
Function OnTop(cForm)
Local hWnd := GetFormHandle( cForm )
SetForeGroundWindow( hWnd )
Return Nil
    	
    	

Re: Disappearing Bos Taurus Image

Posted: Mon Aug 28, 2017 3:10 pm
by bluebird
Thanks for the reply. I added 2 lines to you code and replied that the problem with holding the 2 red lines
still exixts.

Re: Disappearing Bos Taurus Image

Posted: Mon Aug 28, 2017 3:28 pm
by edk
After each ERASE WINDOW wName you need to re-draw red lines.
ERASE WINDOW wName wipe all displayed graphics into wName window.

Re: Disappearing Bos Taurus Image

Posted: Mon Apr 25, 2022 12:19 pm
by mustafa
Hola amigos:
Tengo un problema con las manecillas del reloj
creado por "vientopamperosur" el cual he modificado
para incorporar a esta aplicación.
https://www.hmgforum.com/viewtopic.php? ... ock#p43746

El problema es con la manecillas , la manecilla color Rojo
cuando se pulsa los botones de Arriba, Abajo , Anterior, Siguiente
queda como un abanico y si se pulso los campos de grid de Arriba
o hacia Abajo para correr los registros pasa lo mismo.

El fichero PedidoA.prg es el original (sin cambios)
El fichero PedidoB.prg tiene un arreglo de Atrapa Pantalla
pero tampoco está funcionando.

Aguna idea chicos ? Gracias

Mustafa
*------------------------ Google -----------------------*
Hello friends:

I have a problem with the hands of the clock
created by "vientopamperosur" which I have modified
to incorporate into this application.
https://www.hmgforum.com/viewtopic.php? ... ock#p43746

The problem is with the clock hands, clock hands "Red Color"
when the Up, Down, Previous, Next buttons are pressed
It looks like a fan and if the fields of the grid above are pressed
or Down to run the records does the same thing.

The PedidoA.prg file is the original (without changes)
The PedidoB.prg file has a Screen Catch fix
but it's not working either.

Any idea guys? Thank you

Mustafa

Re: Disappearing Bos Taurus Image

Posted: Mon Apr 25, 2022 7:04 pm
by SALINETAS24
mustafa wrote: Mon Apr 25, 2022 12:19 pm Hola amigos:
Tengo un problema con las manecillas del reloj .../...

Mustafa
Yeeep amigacho.., estas fet un artista!!!

Tengo dos ideas, las dos son malas pero no tengo otras :lol:

El principal problema es que un DRAW no se puede borrar, se tienen que borrar todos mediante un ERASE y eso provoca un pequeño parpadeo.

1ª IDEA. - CON ERASE.

He creado una WINDOW PANEL dentro de la definicion de tu DEFINE WINDOW Form_1 para que contenga el reloj
... / ...
Box( 179,1078, 159, 159 ,"346rhs", 255, 255, 255 )
SetProperty("Form_1","Label_346rhs","Enabled", .T. )

*--------------------------------------------------------------------------------*
// Esto es nuevo
DEFINE WINDOW WinPanel ;
ROW 175 ;
COL 1075 ;
WIDTH 160 ;
HEIGHT 160 ;
WINDOWTYPE PANEL

@ 5,5 IMAGE RELOJ PICTURE 'Resource\reloj.bmp' WIDTH 155 HEIGHT 155 STRETCH

END WINDOW
// HASTA AQUI

DEFINE TIMER Memory INTERVAL 1000 ACTION ( RELEASE MEMORY )
DEFINE TIMER TIME INTERVAL 1000 ACTION ( Dibuja() )

*--------------------------------------------------------------------------------*
.../....
y acto seguido he modificado la funcion "Static Function Dibuja()" de esta forma
*------------------------------------------------------------------------------*
Static Function Dibuja()
*------------------------------------------------------------------------------*
* https://www.hmgforum.com/viewtopic.php? ... ock#p43746
* By vientopamperosur modificado by Mustafa

LOCAL radians := 3.1415926535 / 180 // <=== NO Se declaran arriba como PUBLIC
LOCAL Seg := VAL(SUBSTR(Time(),7,2))
LOCAL Min := VAL(SUBSTR(Time(),4,2))
LOCAL Hor := VAL(SUBSTR(Time(),1,2))

LOCAL segY2 := 80 +Sin(Seg * 6 * radians)*45
LOCAL segX2 := 80 -Cos(Seg * 6 * radians)*45

LOCAL minY2 := 80+Sin(Min * 6 * radians)*40
LOCAL minX2 := 80-Cos(Min * 6 * radians)*40

LOCAL IncrMinHr := Min / 60

LOCAL horY2 := 80+Sin((Hor + IncrMinHr) * 30 * radians) * 35
LOCAL horX2 := 80-Cos((Hor + IncrMinHr) * 30 * radians) * 35


*-------------------------------------------------------------*

* WinPanel.RELOJ.Picture := 'Resource\reloj.bmp'

// Esto provoca un pequeño parpado
ERASE WINDOW Winpanel
DRAW LINE IN WINDOW WinPanel AT 80,80 TO horX2,horY2 PENCOLOR { 000,000,000 } PENWIDTH 4
DRAW LINE IN WINDOW WinPanel AT 80,80 TO minX2,minY2 PENCOLOR { 000,000,000 } PENWIDTH 4
DRAW LINE IN WINDOW WinPanel AT 80,80 TO segX2,segY2 PENCOLOR { 255,000,000 } PENWIDTH 3


RETURN NIL
De esta forma se miniminiza el parpadeo al actuar solo el comando ERASE sobre la window panel

Y la 2ª Opción.

Esta mola más pero es algo más complicada, ya que necesitas saber el color exacto del fondo del reloj.
Yo lo he probado con WHITE pero creo que es algo más oscuro.

Te defines 6 variables para contener las coordenadas antiguas
PRIVATE nHorX1:=nHorY2:=nMinX1:=nMinY2:nSegX1:=nSegX2:=0
Y ahora en la funcion DIBUJA pondrias algo como esto
IF nHorX1!=horX2 .OR. nHorY2!=horY2
// Veo que si tengo algun valor tengo que pintar de color original... un gris raro
IF nHorX1!=0
DRAW LINE IN WINDOW Form_1 AT 265,1165 TO nHorX1,nHorY2 PENCOLOR WHITE PENWIDTH 4
ENDIF
// Actualizo Valores
nHorX1:=horX2
nHorY2:=horY2
// Pinto la hora Correcta
DRAW LINE IN WINDOW Form_1 AT 265,1165 TO horX2,horY2 PENCOLOR { 000,000,000 } PENWIDTH 4
ENDIF
Y lo mismo para los minutos y los segundos....
Esta 2ª opción evita los parpadeos.., pero claro amigo..., tienes que buscar el colorete!!! :lol:

Ya me dices si te gustan.
Un saludo una cervecita bien fresquita!!!

Re: Disappearing Bos Taurus Image

Posted: Tue Apr 26, 2022 10:38 am
by mustafa
Hola amigo:
Como siempre tu "Docta sabiduría" :idea: es bien aceptada , para mi "ignorancia" je... je.. :lol: :lol:
intentaré experimentar con tu código , haber si me aclaro , je... je.. :lol: :? :cry:

Una forta abraça !!!
Mustafa