[Mono-winforms-list] MaskedTextBox.GetCharFromPosition Method

aatdark at aol.com aatdark at aol.com
Sat May 5 08:45:12 EDT 2007


 Hi
I have written lots of nunit tests for the Function and they are all runnning well on MS .NET 2.0


 No i'm proceding with step 2.

for now i try to get the correct line with
Line line = document.GetLineByPixel(p.Y,false);



but the problem is: How can i get the char index from the position in pixels?
I can only use the 

LineTagToCharIndex

if i know the char index.

Because there could be different fonts. The only solution seems to be to call the Grapics.MeasureText method for each letter.

for example if the Text is:
HiTestText
I have to measure
H
Hi
HiT
HiTe
...

But this seems to be terrible slow?
Anyone a better solution for this ?

Yours,
Berni

-----Original Message-----
From: Jackson Harper <jackson at ximian.com>
To: aatdark at aol.com
Cc: mono-winforms-list at lists.ximian.com
Sent: Thu, 3 May 2007 8:43 pm
Subject: Re: [Mono-winforms-list] MaskedTextBox.GetCharFromPosition Method

 
 
On Thu, 2007-05-03 at 13:58 -0400, aatdark at aol.com wrote:
> hi
> concerning 1.)
> Is there already an excisiting nunit file forthe MaskedTextBox ? I
> can't find one
> 

You should probably start by unit testing TextBoxBase, I would just add
your tests to TextBoxTest at first, then we can add some more to
MaskedTextBox later.  But it is best to test from the bottom up.  Since
you will have to implement this feature from the bottom up.

Cheers,
Jackson


> 
> yours
> berni
> 
> -----Original Message-----
> From: Jackson Harper <jackson at ximian.com>
> To: aatdark at aol.com
> Cc: mono-winforms-list at lists.ximian.com
> Sent: Thu, 3 May 2007 7:17 pm
> Subject: Re: [Mono-winforms-list] MaskedTextBox.GetCharFromPosition
> Method
> 
> 
> 
> These methods just need to be implemented in the base TextBoxBase class.
> 
> All you should need to do is:
> 
> 
> 
> 1.  Write lots of unit tests
> 
> 2.  Implement using TextControl::LineTagToCharIndex
> 
> 3.  Remove the notyet ifdef in MaskedTextBox
> 
> 4.  Send your patches to the list
> 
> 
> 
> Please note, don't proceed to step 2 before completing step 1.
> 
> 
> 
> Good luck!
> 
> Jackson
> 
> 
> 
> 
> 
> On Thu, 2007-05-03 at 13:33 -0400, aatdark at aol.com wrote:
> 
> > Hi
> 
> > 
> 
> > Is anyone working at the MaskedTextBox.GetCharFromPosition Method  at
> 
> > the moment?
> 
> > I think implementing this will affect TextControl.cs class Document
> 
> > too.
> 
> > 
> 
> > I'm going to try it if nobody is on it 
> 
> > 
> 
> > yours
> 
> > berni
> 
> > 
> 
> > 
> 
> > ______________________________________________________________________
> 
> > AOL now offers free email to everyone. Find out more about what's free
> 
> > from AOL at AOL.com.
> 
> > 
> 
> > _______________________________________________
> 
> > Mono-winforms-list maillist  -  Mono-winforms-list at lists.ximian.com
> 
> > http://lists.ximian.com/mailman/listinfo/mono-winforms-list
> 
> 
> 
> 
> ______________________________________________________________________
> AOL now offers free email to everyone. Find out more about what's free
> from AOL at AOL.com.
> 
> _______________________________________________
> Mono-winforms-list maillist  -  Mono-winforms-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-winforms-list


 
  
________________________________________________________________________
AOL now offers free email to everyone.  Find out more about what's free from AOL at AOL.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-winforms-list/attachments/20070505/b735bf58/attachment.html 


More information about the Mono-winforms-list mailing list