|
|
Home » U++ Library support » LineEdit, EditFields, DocEdit » Set color in lineedit widget
Set color in lineedit widget [message #9433] |
Mon, 07 May 2007 22:46  |
 |
michael
Messages: 153 Registered: May 2007 Location: Germany
|
Experienced Member |
|
|
I want to output some user-actions in my application like user logged in and so on...
Is the LineEdit the right widget for this?
If yes, how can i add text, set fontsize, fontcolor and backgroundcolor in LineEdit widget?
Sorry for those basic questions, i'm still very new to ultimate++ and do not understand some maybe well documented things in the manual.
Thanks.
Michael
[Updated on: Tue, 08 May 2007 10:45] Report message to a moderator
|
|
|
Re: Set color in lineedit widget [message #9436 is a reply to message #9433] |
Tue, 08 May 2007 13:03   |
mrjt
Messages: 705 Registered: March 2007 Location: London
|
Contributor |
|
|
You can change the font using LineEdit::SetFont. Colors are set with LineEdit::SetColor. For example:
editctrl.SetFont(Font::ARIAL, 16);
editctrl.SetColor(INK_NORMAL, Blue());
The colours that can be set are defined in CtrlLib/TextEdit.h. It is not possible to set colours for individual lines.
James
[edit] added brace for code
[Updated on: Tue, 08 May 2007 13:18] by Moderator Report message to a moderator
|
|
|
|
|
Re: Set color in lineedit widget [message #9439 is a reply to message #9433] |
Tue, 08 May 2007 13:28   |
 |
michael
Messages: 153 Registered: May 2007 Location: Germany
|
Experienced Member |
|
|
changed it but same 'undeclared error'.
G:\Entwicklung\UPP\prohibisZA\main.cpp: In constructor `prohibisZA::prohibisZA()':
G:\Entwicklung\UPP\prohibisZA\main.cpp:29: error: no matching function for call to `Upp::LineEdit::SetFont(Upp::Font::<anonymous enum>, in
t)'
C:/Programme/UltimatePP/uppsrc/CtrlLib/TextEdit.h:311: note: candidates are: Upp::LineEdit& Upp::LineEdit::SetFont(Upp::Font)
G:\Entwicklung\UPP\prohibisZA\main.cpp:30: error: `INK_NORMAL' undeclared (first use this function)
is there anything special to include when using color or font?
and how can i add simple strings to this LineEdit Control?
Don't think i'm too lazy to read the manual, but i didn't get it there...
Michael
[Updated on: Tue, 08 May 2007 14:48] Report message to a moderator
|
|
|
|
|
Re: Set color in lineedit widget [message #9445 is a reply to message #9444] |
Tue, 08 May 2007 16:50   |
mrjt
Messages: 705 Registered: March 2007 Location: London
|
Contributor |
|
|
Use LineEdit::Insert to add lines. For instance:
editctrl.Insert(editctrl.GetLength(), "Some text\nSome More text\n")
Appends two lines to the end of the text.
There are two ways of find functions like these yourself that are much quicker than asking here or even using the manual:
- Typing the name of the class or an instantialion of it followed by :: or . (ie LineEdit::) brings up the autocomplete box with all the member functions for that class and allows filtering as you type.
- Query(Ctrl-Q) allows you to find functions, classes and enums very quickly. For instance, querying 'Blue' takes you straight to all the color definitions. Right clicking on a function gives the option to goto the definition/declaration.
James
[Updated on: Tue, 08 May 2007 16:59] Report message to a moderator
|
|
|
|
|
Re: Set color in lineedit widget [message #9884 is a reply to message #9443] |
Wed, 06 June 2007 13:04   |
waxblood
Messages: 95 Registered: January 2007
|
Member |
|
|
mrjt wrote on Tue, 08 May 2007 16:19 | My humble apologies, the code segment above contained some glaring errors. The correct code is:
editctrl.SetFont(Font(Font::ARIAL, 14));
editctrl.SetColor(LineEdit::INK_NORMAL, SBlue());
Serves me right for not compiling it myself.
|
SBlue() seems to be deprecated
extract from Draw.h
//DEPRECATED: TODO
Color SBlack();
Color SGray();
Color SLtGray();
Color SWhiteGray();
Color SWhite();
Color SRed();
Color SGreen();
Color SBrown();
Color SBlue();
Color SMagenta();
Color SCyan();
Color SYellow();
Color SLtRed();
Color SLtGreen();
Color SLtYellow();
Color SLtBlue();
Color SLtMagenta();
Color SLtCyan();
//END OF DEPRECATED
the right color names seem to be without the S in front of them
i.e. Blue() instead of SBlue()
Ciao,
David
[Updated on: Wed, 06 June 2007 13:05] Report message to a moderator
|
|
|
|
Goto Forum:
Current Time: Sat Apr 26 14:36:30 CEST 2025
Total time taken to generate the page: 0.01117 seconds
|
|
|