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 » LineEdit, EditFields, DocEdit » Should EditField::Paint respect IsEditable method???
Should EditField::Paint respect IsEditable method??? [message #39578] Mon, 01 April 2013 00:44 Go to next message
Klugier is currently offline  Klugier
Messages: 882
Registered: September 2012
Location: Poland, Kraków
Experienced Contributor
Hello,

I have noticed that EditField::Paint dosen't use textdisabled style variable after I called method SetEditable(false) on my EditField. Personally, I think it should be default behavior for this widget. Of course, I can be wrong and this behavior is intentional.

I have written simply patch (CtrlLib/EditField.cpp - line 289):

void EditField::Paint(Draw& w)
{
	Size sz = GetSize();
	bool enabled = IsShowEnabled();
	Color paper = enabled && !IsReadOnly() ? (HasFocus() ? style->focus : style->paper) : style->disabled;
	if(nobg)
            paper = Null;
	Color ink = enabled && !IsReadOnly() ? style->text : style->textdisabled; // <- This line
        ...
}


I have enclosed demonstrative images.

Befor:
index.php?t=getfile&id=4126&private=0

After:
index.php?t=getfile&id=4127&private=0

P.S
I have found the easy solution. I need to call other method on EditField insted of SetEditable. It is SetEnable method. At the end, I would like to enclose sample code:

editField.SetEnable(false);


It works exactly as I want.

Sincerely,
Klugier

  • Attachment: befor.png
    (Size: 3.60KB, Downloaded 576 times)
  • Attachment: after.png
    (Size: 3.64KB, Downloaded 819 times)


Ultimate++ - one framework to rule them all.

[Updated on: Mon, 01 April 2013 17:25]

Report message to a moderator

Re: Should EditField::Paint respect IsEditable method??? [message #39670 is a reply to message #39578] Tue, 16 April 2013 19:48 Go to previous message
mirek is currently offline  mirek
Messages: 13442
Registered: November 2005
Ultimate Member
Well, it all is because there is difference between "disabled" and "readonly".

In disabled state, widget is completely inactive. In read-only state, you cannot change its value, but you can e.g. copy text from it or scroll content.

Visuals are trying to express this fact.

Mirek
Previous Topic: BUG: LineEdit "Drag And Drop" violates read-only state
Next Topic: Wrap EditString Rect to text
Goto Forum:
  


Current Time: Sat Oct 23 17:35:44 CEST 2021

Total time taken to generate the page: 0.00833 seconds