IonicWind Software

IWBasic => GUI Central => Topic started by: uzimir on November 25, 2007, 12:09:47 PM

Title: Background color in Rich Edit control
Post by: uzimir on November 25, 2007, 12:09:47 PM
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
Title: Re: Background color in Rich Edit control
Post by: sapero on November 25, 2007, 12:45:17 PM
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.
Title: Re: Background color in Rich Edit control
Post by: Bruce Peaslee on November 25, 2007, 02:51:33 PM
Quote from: sapero on November 25, 2007, 12:45:17 PM
BTW this is Aurora forum.

Sure is. I can move it for you.
Title: Re: Background color in Rich Edit control
Post by: uzimir on November 25, 2007, 03:18:02 PM
So it's perfect thank you ;D

Sorry to have posted in the wrong forum.