label refresh problem with background color

Moderator: Rathinagiri

Post Reply
User avatar
gert_w
Posts: 3
Joined: Fri Jun 17, 2011 6:42 pm
Location: Germany

label refresh problem with background color

Post 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
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

label refresh problem with background color

Post 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 237 times
demo1.rar
Executable file demo
(577.41 KiB) Downloaded 271 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.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Amarante
Posts: 182
Joined: Fri Apr 27, 2012 9:44 pm
DBs Used: DBF, MySQL, MariaDB, SQLite, PostgreSQL
Location: Araruama-RJ, Brazil

Re: label refresh problem with background color

Post 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
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

label refresh problem with background color

Post 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...
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Amarante
Posts: 182
Joined: Fri Apr 27, 2012 9:44 pm
DBs Used: DBF, MySQL, MariaDB, SQLite, PostgreSQL
Location: Araruama-RJ, Brazil

Re: label refresh problem with background color

Post by Amarante »

Pablo,
Como já dizia Caetano Veloso, de perto ninguem é normal. :lol:
-------------
Pablo,
As I said Caetano Veloso, closely nobody is normal. :lol:
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

label refresh problem with background color

Post 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. :?
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: label refresh problem with background color

Post by srvet_claudio »

Voy a chequearlo.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
Post Reply