October 28, 2025, 02:36:26 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Background color in Rich Edit control

Started by uzimir, November 25, 2007, 12:09:47 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

uzimir

It's the first time I post in this forum so hi to all and forgive my poor english.

Come to my problem, I'm trying to set the background color of a rich edit control using the SETCONTROLCOLOR statement, but it doesn't work. ???

Here is my code, where I'd like the rich edit control background become blue when I press the button...


CONST RICHEDIT_1 = 1
CONST BUTTON_2 = 2
DIALOG d1
CREATEDIALOG d1,0,0,300,202,0x80C80080,0,"Caption",&d1_handler
CONTROL d1,@RICHEDIT,"",25,15,227,36,0x50800004,RICHEDIT_1
CONTROL d1,@BUTTON,"Button1",27,81,70,20,0x50000000,BUTTON_2

DOMODAL d1
END


SUB d1_handler
SELECT @MESSAGE
CASE @IDINITDIALOG
CENTERWINDOW d1
/* Initialize any controls here */
CASE @IDCLOSEWINDOW
CLOSEDIALOG d1,@IDOK
CASE @IDCONTROL
SELECT @CONTROLID
CASE RICHEDIT_1
/* respond to control notifications here */
CASE BUTTON_2
IF @NOTIFYCODE = 0
SETCONTROLCOLOR d1, RICHEDIT_1, RGB(0,0,255), RGB(0,0,255)
ENDIF
ENDSELECT
ENDSELECT
RETURN
ENDSUB



Help in advance for your help

Stefano

sapero

Hello uzimir,

SETCONTROLCOLOR does not work for all controls. Richedit has support for changing background color via EM_SETBKGNDCOLOR message:
CONST EM_SETBKGNDCOLOR = (0x400 + 67)

[...] CASE BUTTON_2 [...]
   SendMessage d1, EM_SETBKGNDCOLOR, false, RGB(0,0,255), RICHEDIT_1

To restore the original color, change 'false' to nonzero value.

BTW this is Aurora forum.

Bruce Peaslee

Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

uzimir

So it's perfect thank you ;D

Sorry to have posted in the wrong forum.