[Mono-winforms-list] MaskedTextBox.GetCharFromPosition Method
aatdark at aol.com
aatdark at aol.com
Sat May 5 16:44:19 EDT 2007
hi
I expirienced a major problem:
I run my function againt the one from MS and itereatet
the point.X coordinate from 0 to 90
It seems to be that MS uses an other font or such thing. I testet this and the only difference is the GdiCharSet=1 in mono
Problem: Look at the 17A and 12A.
In my code the A startet at the X coordinate 17 and at MS's code it startet at 12
text = "XXABCQEWRY";
Mono
0 X
1 X??? 2 X??? 3 X??? 4 X??? 5 X
6 X??? 7 X??? 8 X??? 9 X??? 10 X
11 X??? 12 X??? 13 X??? 14 X??? 15 X
16 X??? 17 A??? 18 A??? 19 A??? 20 A
21 A??? 22 A??? 23 A??? 24 A??? 25 B
26 B??? 27 B??? 28 B??? 29 B??? 30 B
31 B??? 32 C??? 33 C??? 34 C??? 35 C
36 C??? 37 C??? 38 C??? 39 C??? 40 Q
41 Q??? 42 Q??? 43 Q??? 44 Q??? 45 Q
46 Q??? 47 Q??? 48 E??? 49 E??? 50 E
51 E??? 52 E??? 53 E??? 54 E??? 55 E
56 W??? 57 W??? 58 W??? 59 W??? 60 W
61 W??? 62 W??? 63 W??? 64 W??? 65 W
66 R??? 67 R??? 68 R??? 69 R??? 70 R
71 R??? 72 R??? 73 R??? 74 Y??? 75 Y
76 Y??? 77 Y??? 78 Y??? 79 Y??? 80 Y
81 Y??? 82 Y??? 83 Y??? 84 Y??? 85 Y
86 Y??? 87 Y??? 88 Y??? 89 Y
MS
0 X
1 X??? 2 X??? 3 X??? 4 X??? 5 X
6 X??? 7 X??? 8 X??? 9 X??? 10 X
11 X??? 12 A??? 13 A??? 14 A??? 15 A
16 A??? 17 A??? 18 A??? 19 B??? 20 B
21 B??? 22 B??? 23 B??? 24 B??? 25 B
26 C??? 27 C??? 28 C??? 29 C??? 30 C
31 C??? 32 C??? 33 Q??? 34 Q??? 35 Q
36 Q??? 37 Q??? 38 Q??? 39 Q??? 40 E
41 E??? 42 E??? 43 E??? 44 E??? 45 E
46 E??? 47 E??? 48 W??? 49 W??? 50 W
51 W??? 52 W??? 53 W??? 54 W??? 55 W
56 W??? 57 R??? 58 R??? 59 R??? 60 R
61 R??? 62 R??? 63 R??? 64 R??? 65 R
66 Y??? 67 Y??? 68 Y??? 69 Y??? 70 Y
71 Y??? 72 Y??? 73 Y??? 74 Y??? 75 Y
76 Y??? 77 Y??? 78 Y??? 79 Y??? 80 Y
81 Y??? 82 Y??? 83 Y??? 84 Y??? 85 Y
86 Y??? 87 Y??? 88 Y??? 89 Y
I used the following code
LineTag tag = document.FindTag(p.X,p.Y,out index,false);
return tag.Text()[lenght-1]
Does anyone know an workaround ?
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: Sat, 5 May 2007 8:28 pm
Subject: Re: [Mono-winforms-list] MaskedTextBox.GetCharFromPosition Method
TextControl::FindTag takes pixel coordinates and returns a line tag
aswell as a char index.
On Sat, 2007-05-05 at 08:45 -0400, aatdark at aol.com wrote:
> 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.
>
> _______________________________________________
> 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/ba416bdc/attachment-0001.html
More information about the Mono-winforms-list
mailing list