Page 1 of 1

DisabledBackColor and DisabledFontColor

Posted: Sat Jun 13, 2020 11:03 am
by serge_girard
Hello,

I want to change backcolor (or fontcolor) in RED when some value is wrong in a READONLY field and I use this code:

Code: Select all

@ 10,10 TEXTBOX T_1	Of Form_1		;
	WIDTH  50		;
	VALUE 'something'    ;
	MAXLENGTH 40	;
	TOOLTIP 'something' ;
	FONT 'Arial' SIZE 10	;	
	BACKCOLOR WHITE	;
	FONTCOLOR BLUE BOLD ;
   READONLY

Form_1.T_1.DisabledBackColor :=  RED
Form_1.T_1.DisabledFontColor :=  RED
SetProperty ( 'Form_1' , 'T_1', 'DisabledBackColor',  RED)
SetProperty ( 'Form_1' , 'T_1', 'DisabledFontColor',  RED)
But both methods seem to do nothing. Anybody knows why this isn't working?

Serge

Re: DisabledBackColor and DisabledFontColor

Posted: Sat Jun 13, 2020 1:25 pm
by andyglezl
Hola Serge

Creo que eso me paso a mi y lo solucione de esta forma.
*---------------------------------------------------------------------
Hi Serge

I think that happened to me and I solved it this way.

Code: Select all

	@ 035,220 EDITBOX EB_1 WIDTH 790 HEIGHT 630 VALUE "" FONT "Arial" SIZE 10 FONTCOLOR BLACK BACKCOLOR { 227, 239, 255 }  ;
			NOHSCROLL   MAXLENGTH 60000 DISABLEDFONTCOLOR BLACK DISABLEDBACKCOLOR { 227, 239, 255 } 
	w_test.EB_1.ReadOnly := .F.

.............

IF something
	w_test.EB_1.ReadOnly := .F.
ELSE
	w_test.EB_1.ReadOnly := .T.
ENDIF

Re: DisabledBackColor and DisabledFontColor

Posted: Sat Jun 13, 2020 3:30 pm
by serge_girard
Thanks Andres, I will try!

Serge

Re: DisabledBackColor and DisabledFontColor

Posted: Sun Jun 14, 2020 5:11 pm
by jozef
serge_girard wrote: Sat Jun 13, 2020 11:03 am Hello,

I want to change backcolor (or fontcolor) in RED when some value is wrong in a READONLY field and I use this code:

Code: Select all

@ 10,10 TEXTBOX T_1	Of Form_1		;
	WIDTH  50		;
	VALUE 'something'    ;
	MAXLENGTH 40	;
	TOOLTIP 'something' ;
	FONT 'Arial' SIZE 10	;	
	BACKCOLOR WHITE	;
	FONTCOLOR BLUE BOLD ;
   READONLY

Form_1.T_1.DisabledBackColor :=  RED
Form_1.T_1.DisabledFontColor :=  RED
SetProperty ( 'Form_1' , 'T_1', 'DisabledBackColor',  RED)
SetProperty ( 'Form_1' , 'T_1', 'DisabledFontColor',  RED)
But both methods seem to do nothing. Anybody knows why this isn't working?

Serge
Hi Serge,

I have the same problem. And I found this http://www.hmgforum.com/viewtopic.php?f ... ive#p49712

Jozef

Re: DisabledBackColor and DisabledFontColor

Posted: Mon Jun 15, 2020 7:01 am
by serge_girard
Thanks Jozef, I change my TEXTBOX to ENABLED!

Serge

Re: DisabledBackColor and DisabledFontColor

Posted: Mon Jun 15, 2020 4:58 pm
by franco
Hi Serge, I do this a different way.
If you enable the textbox the data can be changed.
What I do is change the fontcolor of the label of the textbox if something .

Code: Select all

Win.Label.FontColor := BLACK
If win.textbox.value = "No"
   win.Label.fontcolor := RED
endif
Do not know if this is similar.
Franco

Re: DisabledBackColor and DisabledFontColor

Posted: Mon Jun 15, 2020 6:05 pm
by mol
Textbox can be enabled, but readonly. Then it should work.
When you don't need interaction with user, you can use label with clientedge. Such a label looks like textbox

Re: DisabledBackColor and DisabledFontColor

Posted: Mon Jun 15, 2020 8:09 pm
by jorge_riv
Prueba esto:

@ 10,10 TEXTBOX T_1 Of Form_1 ;
WIDTH 50 ;
VALUE 'something' ;
MAXLENGTH 40 ;
TOOLTIP 'something' ;
FONT 'Arial' SIZE 10 ;
BACKCOLOR WHITE ;
FONTCOLOR BLUE BOLD ;
READONLY
...
...
Form_1.T_1.FontColor := IF( lROnly, BLACK , RED } )
Form_1.T_1.BackColor := IF( lROnly, YELLOW, BLUE )

Re: DisabledBackColor and DisabledFontColor

Posted: Mon Jun 15, 2020 8:39 pm
by serge_girard
Thanks all for helping!

Serge