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