DisabledBackColor and DisabledFontColor

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
serge_girard
Posts: 3309
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

DisabledBackColor and DisabledFontColor

Post 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
There's nothing you can do that can't be done...
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: DisabledBackColor and DisabledFontColor

Post 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
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
serge_girard
Posts: 3309
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: DisabledBackColor and DisabledFontColor

Post by serge_girard »

Thanks Andres, I will try!

Serge
There's nothing you can do that can't be done...
jozef
Posts: 23
Joined: Sat Apr 02, 2016 4:53 pm
DBs Used: DBF
Location: Bratislava, Slovak Republic

Re: DisabledBackColor and DisabledFontColor

Post 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
User avatar
serge_girard
Posts: 3309
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: DisabledBackColor and DisabledFontColor

Post by serge_girard »

Thanks Jozef, I change my TEXTBOX to ENABLED!

Serge
There's nothing you can do that can't be done...
franco
Posts: 877
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: DisabledBackColor and DisabledFontColor

Post 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
Last edited by franco on Mon Jun 15, 2020 6:23 pm, edited 1 time in total.
All The Best,
Franco
Canada
User avatar
mol
Posts: 3774
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: DisabledBackColor and DisabledFontColor

Post 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
User avatar
jorge_riv
Posts: 86
Joined: Thu Nov 22, 2018 2:20 pm
DBs Used: DBF, MySQL,SQL SERVER, Oracle.

Re: DisabledBackColor and DisabledFontColor

Post 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 )
User avatar
serge_girard
Posts: 3309
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: DisabledBackColor and DisabledFontColor

Post by serge_girard »

Thanks all for helping!

Serge
There's nothing you can do that can't be done...
Post Reply