[Mono-winforms-list] GetPositionFromCharIndex

Maser, Dan Dan.Maser at inin.com
Tue May 15 09:38:23 EDT 2007


  Ahh, excellent!  Many thanks for your time and effort on these
methods.

  Here's what I have on my list that involves TextBox controls left to
be done:

* In my app I have some text boxes with the read-only flag set.  As
expected, those text boxes ignore typed keys.  However, if I select some
text, then right-click, then pick 'Delete' from the context menu the
text from the textbox is deleted.  I think the 'Delete' option on the
context menu should be greyed when the textbox is read-only.

* The textbox doesn't seem to honor the new 2.0 ContextMenuStrip.  In my
app I assigned a ContextMenuStrip to the textbox control.  But when I
right click it, some kind of default context menu strip is shown always
and my custom one is never shown.  I also noted that the textbox's
'ContextMenu' property is null, so it's not a mistake with the
ContextMenu overriding the 'ContextMenuStrip'.   From what I can tell
the proper behavior is:
	1. the 'ContextMenuStrip' should be honored if non-null
	2. the 'ContextMenu' property should be honored if non-null
	3. search the parent windows for a non-null 'ContextMenuStrip or
'ContextMenu' and show that if non-null.
	4. if none of the windows to the base parent have a context
menu, then show the default textbox context menu with the
Copy/Paste/Delete choices.

* I Have these two bugs that I filed about TextBoxes still in the 'NEW'
state:
http://bugzilla.ximian.com/show_bug.cgi?id=81598
http://bugzilla.ximian.com/show_bug.cgi?id=81616
 

   Again, thanks for your time and effort!


-----Original Message-----
From: Jackson Harper [mailto:jackson at ximian.com] 
Sent: Monday, May 14, 2007 9:14 PM
To: Maser, Dan
Cc: monkeyx; mono-winforms-list at lists.ximian.com
Subject: RE: [Mono-winforms-list] GetPositionFromCharIndex

On Mon, 2007-05-14 at 20:57 -0400, Maser, Dan wrote:
>   Would it make sense to also implement the 
> 
> GetFirstCharIndexFromLine
> 
>   function while you're in that code and working with the position
> variables?  My app uses that function but has it's feature
conditionally
> compiled out right now.   

It would.  Which is why I did :-).

Those four similarly named functions are all implemented now.  I'll be
working on finishing off the rest of the 2.0 text control functions this
week. 

Are there any in particular that you are using, that you would like to
see implemented?

Cheers,
Jackson


> Regards,
>    Dan
> 
> -----Original Message-----
> From: mono-winforms-list-bounces at lists.ximian.com
> [mailto:mono-winforms-list-bounces at lists.ximian.com] On Behalf Of
> Jackson Harper
> Sent: Monday, May 14, 2007 5:16 PM
> To: monkeyx
> Cc: mono-winforms-list at lists.ximian.com
> Subject: Re: [Mono-winforms-list] GetPositionFromCharIndex
> 
> 
> Just an FYI.
> 
> This method is now implemented in the SVN version of winforms.
> 
> Cheers,
> Jackson
> 
> 
> 
> 
> On Thu, 2007-05-10 at 12:46 -0700, monkeyx wrote:
> > I am having some problems getting GetPositionFromCharIndex to work
on
> Mono
> > 1.2.3 and libgdiplus 1.2.3
> > Tested issue on Ubuntu 7.04 and Suse 10.2 using even built sources
on
> Centos
> > 5 all give same error.
> > 
> > I have shown code and crash error below, has anyone else seen this
> error or
> > advise me on how I can help fix it!
> > 
> >           if (e.KeyCode == Keys.OemPeriod && e.Shift == true)
> > 
> >            {
> > 
> > 
> > 
> >                index = richTextBox1.SelectionStart;
> > 
> > // This line appears to be causing crash
> > 
> >                pt = richTextBox1.GetPositionFromCharIndex(index);
> > 
> >                pt.X += richTextBox1.Location.X;
> > 
> >                pt.Y += richTextBox1.Location.Y;
> > 
> > 
> > 
> >                lstboxEdit.Location = pt;
> > 
> > 
> > 
> >                lstboxEdit.Visible = true;
> > 
> >            }
> > 
> > This is summary of crash error
> > ** (lpOED.exe:6904): WARNING **: Missing method
> > System.Windows.Forms.TextBoxBase::GetPositionFromCharIndex(int) in
> assembly
> >
>
/usr/lib/mono/gac/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.
> Windows.Forms.dll,
> > referenced in assembly /media/MightyDrive/lpOED.exe
> > System.MissingMethodException: Method not found:
> > 'System.Windows.Forms.TextBoxBase.GetPositionFromCharIndex'.
> >   at <0x00000> <unknown method>
> 
> _______________________________________________
> Mono-winforms-list maillist  -  Mono-winforms-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-winforms-list
> 
> 





More information about the Mono-winforms-list mailing list