patchDotGNU Portable.NET - Patches: patch #3630, Fix some problems in TextBox

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #3630: Fix some problems in TextBox

Submitter:  Marc Haisenko <darkdust>
Submitted:  Mon 10 Jan 2005 03:00:36 PM UTC
   
 
Category:  None Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  darkdust Open/Closed:  Closed

Wed 02 Feb 2005 01:55:29 PM UTC, comment #1: 

Committed to CVS on 2. Feb 2005 (TextBox.cs 1.45)

Marc Haisenko <darkdust>
Group Member
Mon 10 Jan 2005 03:00:36 PM UTC, original submission:  

This patch fixes three problems with TextBox.cs: it fixes bug #11553 (TextBox doesn't correctly handle scrollbars), it fixes relayouting on resize and fixes the size calculation in LayoutFromText (discussed below).

I'll discuss every method of TextBox.cs that this patch touches and explain what I changed and why.

=====
On the class-level itself, two private variables bool showVScrollBar and showHScrollBar have been added. They are used to work around the problem that ScrollBar.Visible is reporting false although it has been set to true when the parent is not visible (see report for bug #11553).

=====
SetupScrollBars:

The return value has been changed from void to bool. This method now returns whether the caller should call SetScrollBarPositions as well. This is necessary to fix the size calculation in LayoutFromText (see discussion of that method).

The calls to SetScrollBarPositions have been removed because it's unnecessary to call that method twice (happened when both scrollbars where enabled) and SetScrollBarPositions calls MaxTextDimensions which will often not be able to return the correct size at this point. Instead a variable "callPositions" gets set which is the value for this method to return, which means "call SetScrollBarPositions when we know the values will be correct"

Before returning we call "SetScrollBarVisibility", a new method that has been split off of SetScrollBarPositions. It sets the show{H,V}ScrollBar variables and {h,v}ScrollBar.Visible properties.

=====
SetScrollBarPositions:

This method has been split into two parts: the code that has set the visibility of the scrollbars has been refactored and is now in SetScrollBarVisibility.

The scrollbar size calculations has been refactored, it has been optimized (and I think it's way more readable now).

=====
SetScrollBarVisibility:

New method, sets whether the scrollbars are visible (sets show{H,V}ScrollBar variables and {h,v}ScrollBar.Visible properties).

=====
MaxTextDimensions:

Now uses show{H,V}ScrollBar variables instead of {h,v}ScrollBar.Visible properties. The reason was already explained, the properties where reporting wrong values when the TextBox parent wasn't visible (well, wrong is not correct here; "unexpected" would be more accurate).

=====
LayoutFromText:

A new bool variable "callSetScrollBarPositions" has been introduced to remember the return value of SetupScrollBars and call SetScrollBarPositions at the end of LayoutFromText if needed.

SetupScrollBars is now called very early so that TextDrawArea works correctly. It has been called at the end of the method but TextDrawArea depends on the correct informations about the scrollbar visibilities !

=====
SetBoundsCore:

If the size has changed we need to set "layout = null" so that LayoutFromText really does a re-layouting. This fixes the bug that no relayouting occurred on a size change.

=====
TextDrawArea:

Replaced {h,v}ScrollBar.Visible with show{h,v}ScrollBar.

Marc Haisenko <darkdust>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #8237:  TextBox.cs.patch added by darkdust (6KiB - text/x-diff - Fix for bug #11553 and two other problems with TextBox.cs)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

 

Follow 4 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2005-02-02 darkdust Assigned toNone darkdust
    Open/ClosedOpen Closed
2005-02-02 darkdust StatusNone Done
2005-01-10 darkdust Attached File- Added TextBox.cs.patch, #4020

Back to the top

Powered by Savane 3.15-94dd.
Corresponding source code