Page 1 of 1

label refresh problem with background color

Posted: Sat Jun 18, 2011 11:03 am
by gert_w
I want to report a problem which is quite old and exists since Harbour 1.0. It does not occuur in HMG 2.0.031 (Harbour 0.99.3) but in all versions after that until now.
I use a label element with background color and overlay it with some other labels (inside). Depending on some data in a grid I change the background color and/or the label text. The demo program shows the same when clicking the buttons YELLOW and GREEN.
When you press the button GREEN twice, then the label text disappers. This is probably because the label text does not change.
My workaround is to assign an empty string first, as you see for button YELLOW.
Well, this looks like a refresh problem, because when I resize the window or move another window over it, then suddenly the GREEN label text appears again.

last tested with HMG 3.0.35 on WinXP SP3

Code: Select all

#include "minigui.ch"

Function Main

	DEFINE WINDOW Form_1 ;
		AT 0,0 WIDTH 640 HEIGHT 480 ;
		TITLE '' ;
		MAIN 

    @ 30,10 LABEL Box_1                     WIDTH 200 HEIGH 100 BACKCOLOR RED
    @ 40,20 LABEL Label_1 VALUE 'hi red'	  WIDTH 180           BOLD TRANSPARENT
		
    @200,10 BUTTON BT_1   CAPTION 'YELLOW'  WIDTH 100 ACTION ChangeColor(1)
	  @240,10 BUTTON BT_2   CAPTION 'GREEN'   WIDTH 100 ACTION ChangeColor(2)

	END WINDOW
	CENTER WINDOW Form_1
	ACTIVATE WINDOW Form_1

Return


function ChangeColor(c)
if c==1
   Form_1.Box_1.backcolor := YELLOW
   Form_1.Label_1.value   := ''           // dummy string
   Form_1.Label_1.value   := 'hi yellow'
else
   Form_1.Box_1.backcolor := GREEN
   Form_1.Label_1.value   := 'hi green'   
endif
Form_1.setfocus
return nil

label refresh problem with background color

Posted: Thu Apr 09, 2015 12:00 am
by Pablo César
This is an old question, but I would check our source concerning the LABEL. And for that I need the HMG 2.0.031 version but I did not found it. :|

Does anyone have this version to pass me ?

I made some changing just to let more in evidence what is still occurring:
Teste15.rar
Source code demo
(616 Bytes) Downloaded 248 times
demo1.rar
Executable file demo
(577.41 KiB) Downloaded 282 times
It's with strange behaviour when is changing to GREEN backcolor of LABEL, the TEXT string is wrongly disappearing.
But if is minimized and restored it displays normally. This happen only after the first time trying in GREEN button.
This error is not concerning by GREEN color. The problem when change backcolor, should not be affected to the caption text. :?

Gert has also prepared YELLOW button with a dummy string doing this:
Form_1.Label_1.value := ""
Form_1.Label_1.value := 'hi yellow'

Then this solve this problem, but surely is not normal procedure... :|

What we have to do is to define if is a Harbour problem (I do not think so), HMG problem or API problem.

Re: label refresh problem with background color

Posted: Thu Apr 09, 2015 5:46 am
by Amarante
Making a refresh on the label solve the problem but not the root of it.

Code: Select all

Function ChangeColor(c)
if c==1
   Form_1.Box_1.backcolor := YELLOW
   Form_1.Label_1.value   := ''           // dummy string
   Form_1.Label_1.value   := 'hi yellow'
else
   Form_1.Box_1.backcolor := GREEN
   Form_1.Label_1.value   := 'hi green'
endif
Form_1.Label_1.Refresh
Return Nil

label refresh problem with background color

Posted: Thu Apr 09, 2015 11:20 am
by Pablo César
Thank you Daniel !

I've tried this but wrongly at form only. I forgot to make it at label as you done.

I do not if this behaviour should be considered as normal...

Re: label refresh problem with background color

Posted: Thu Apr 09, 2015 11:42 am
by Amarante
Pablo,
Como já dizia Caetano Veloso, de perto ninguem é normal. :lol:
-------------
Pablo,
As I said Caetano Veloso, closely nobody is normal. :lol:

label refresh problem with background color

Posted: Thu Apr 09, 2015 12:02 pm
by Pablo César
Amarante wrote:Como já dizia Caetano Veloso, de perto ninguem é normal.
:lol: Sim, é incrível tantas coisas tentei, inclusive o Refresh, mas não no componente certo.

Gostaria de saber do Claudio se esse comportamento pode ser considerado defeito ou não. :?

Re: label refresh problem with background color

Posted: Thu Apr 09, 2015 3:35 pm
by srvet_claudio
Voy a chequearlo.