Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » how to paint a LineEdit? how to create a small image?
how to paint a LineEdit? how to create a small image? [message #10363] Wed, 04 July 2007 10:44 Go to next message
bonami is currently offline  bonami
Messages: 186
Registered: June 2007
Location: Beijing
Experienced Member
all my need is transient. i don't want to implement Pain(). because this is a temporary notification.
my application's main class is like,
class ezcommwin : public WithezcommwinLayout<TopWindow>
which utilizes a .lay

1. is it possible to change a LineEdit's background color?
2. i want to show some image in TopWindow when a button's clicked. But only for a short time.

I've tried Draw (cannot be initiated), DrawingDraw, ViewDraw...
even some built ok, they do not change window's view.
Re: how to paint a LineEdit? how to create a small image? [message #10364 is a reply to message #10363] Wed, 04 July 2007 11:04 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12096
Registered: November 2005
Ultimate Member
TextCtrl::
	enum {
		INK_NORMAL,
		INK_DISABLED,
		INK_SELECTED,
		PAPER_NORMAL,
		PAPER_READONLY,
		PAPER_SELECTED,
		COLOR_COUNT,
	};

	void      SetColor(int i, Color c)         { color[i] = c; Refresh(); }



All the painting should be generally done in Paint. For specific cases you can use tricks like overlapping the widget with e.g. Picture widget which accepts Drawing. Somethine like:

 
LineEdit edit;
Picture picture;
....
// show the picture
picture = my_drawing;
edit.Add(picture.SizePos());
....
// back to LineEdit
picture.Remove();


Mirek
icon9.gif  Re: how to paint a LineEdit? how to create a small image? [message #10385 is a reply to message #10363] Thu, 05 July 2007 06:29 Go to previous messageGo to next message
bonami is currently offline  bonami
Messages: 186
Registered: June 2007
Location: Beijing
Experienced Member
Confused
i have a WithDropChoice<EditInt>, which has no ...Color().

[Updated on: Thu, 05 July 2007 06:41]

Report message to a moderator

Re: how to paint a LineEdit? how to create a small image? [message #10391 is a reply to message #10385] Thu, 05 July 2007 12:50 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
To set one EditField color:
	
	EditField::Style edit_field_style = EditField::StyleDefault();
	edit_field_style.paper = Yellow();
        myedit.SetStyle(edit_field_style);


To set ALL edit field styles:
	EditField::Style edit_field_style = EditField::StyleDefault();
	edit_field_style.paper = Yellow();
	EditField::StyleDefault().Write() = edit_field_style;


Changing the color of the popup menu can be (mostly) done with SetDisplay.

James.

[Updated on: Thu, 05 July 2007 12:50]

Report message to a moderator

Re: how to paint a LineEdit? how to create a small image? [message #10399 is a reply to message #10391] Fri, 06 July 2007 03:50 Go to previous messageGo to next message
bonami is currently offline  bonami
Messages: 186
Registered: June 2007
Location: Beijing
Experienced Member
Mirek, you misunderstood me. i want it to show BESIDE my control, in my TopWindow. Twisted Evil
i wrote this in my TopWindow subclass' method, but nothing happens,

ImageCtrl img;
img.SetImage(CtrlImg::exclamation());
Add(img.SizePos());

mrjt wrote on Thu, 05 July 2007 18:50

To set one EditField color:
	
	EditField::Style edit_field_style = EditField::StyleDefault();
	edit_field_style.paper = Yellow();
        myedit.SetStyle(edit_field_style);


To set ALL edit field styles:
	EditField::Style edit_field_style = EditField::StyleDefault();
	edit_field_style.paper = Yellow();
	EditField::StyleDefault().Write() = edit_field_style;


Changing the color of the popup menu can be (mostly) done with SetDisplay.

James.

why my EditField has no SetStyle() method? and it has no StyleDefault() either. using current version 2007.1

[Updated on: Fri, 06 July 2007 11:57]

Report message to a moderator

Re: how to paint a LineEdit? how to create a small image? [message #10402 is a reply to message #10399] Fri, 06 July 2007 12:08 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Ah. I think that version is too old, the EditField only got Chameleonized more recently. If you get 705-dev3 from SourceForge it will work. There isn't a direct link from the front page but it is there.

Otherwise the only solutions are to overload Paint method or use SColorPaper_Write() to change paper color.

icon14.gif  Re: how to paint a LineEdit? how to create a small image? [message #10423 is a reply to message #10363] Mon, 09 July 2007 04:04 Go to previous message
bonami is currently offline  bonami
Messages: 186
Registered: June 2007
Location: Beijing
Experienced Member
U rock Laughing
Previous Topic: BSD problems with Draw
Next Topic: How to Draw into an existing image(buffer) ?
Goto Forum:
  


Current Time: Tue Nov 12 02:41:18 CET 2019

Total time taken to generate the page: 0.01606 seconds