xsharp.eu • Change SLE Resouce settings realtime - Page 2
Page 2 of 2

Change SLE Resouce settings realtime

Posted: Thu Dec 31, 2020 1:40 pm
by robert
Alf,
SendMessage(self:oDCmLASTNAME:handle(), EM_SETREADONLY, 1,0 ) // to enable readonly

SendMessage(self:oDCmLASTNAME:handle(), EM_SETREADONLY, 0,0 ) // to make read/write

Robert

Change SLE Resouce settings realtime

Posted: Fri Jan 01, 2021 6:34 pm
by Karl-Heinz
Hi Alf,

to set the desired colors you might overwrite the ReadOnly assign. But it doesn´t make sence to create new objects each time the assign is triggered. So you should implement a global system where the required colors and brushes are created only once.

Code: Select all

CLASS MySle INHERIT SingleLineEdit 
	
ASSIGN ReadOnly(lNewValue) CLASS MySle
	
    SUPER:ReadOnly := lNewValue               
	
	IF lNewValue
		SELF:Background := Brush { Color { GetSysColor ( COLOR_BTNFACE ) } } 
		SELF:TextColor := Color { GetSysColor ( COLOR_WINDOWTEXT ) } 
	ELSE 
		SELF:Background := Brush { Color { GetSysColor ( COLOR_WINDOW ) } } 
		SELF:TextColor := Color { GetSysColor ( COLOR_WINDOWTEXT ) } 
	ENDIF 
	
	RETURN 	
BTW: Are you the real Alf ?

Alf - "Can I use the microwave?"
Kate Tanner(Mom) - "Why?"
Alf - "Because the cat doesn't fit in the toaster."

SCNR ;-)

regards
Karl-Heinz

Change SLE Resouce settings realtime

Posted: Sat Jan 02, 2021 12:55 pm
by Alf
Hi Karl-Heinz,
thanks. This works perfect.

<<<BTW: Are you the real Alf ?>>>
Yes, my name is really Alf. But I never put my cat in a microwave (only the barking dogs of my neighbors).

regards
Alf