savita | 22 Feb 2012 13:54

winform drag and drop functionality

Hi, We have developed a drag and drop functionality in .net win form using c#. drag sourse is list box drag target is textbox. It doesn't give any error when compiled in mono. However the drag and drop functionality doesn't work in mono. The text in texbox set as a blank when dragged a list item from listbox. It works fine in .net. Kindly help and let me know what I am missing. I have set the this.textBox1.AllowDrop = true; this.listBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.listBox1_MouseDown); this.textBox1.DragDrop += new System.Windows.Forms.DragEventHandler(this.textBox1_DragDrop); this.textBox1.DragEnter += new System.Windows.Forms.DragEventHandler(this.textBox1_DragEnter); -------------------------------------------- public Form1() { InitializeComponent(); listBox1.Items.Add("ABC"); listBox1.Items.Add("XYZ"); listBox1.Items.Add("AAA"); } private void textBox1_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.Text)) e.Effect = DragDropEffects.Copy; else e.Effect = DragDropEffects.None; } private void textBox1_DragDrop(object sender, DragEventArgs e) { textBox1.Text = (string)e.Data.GetData(DataFormats.StringFormat); ; } private void listBox1_MouseDown(object sender, MouseEventArgs e) { listBox1.DoDragDrop(listBox1.SelectedItem.ToString(), DragDropEffects.Copy); } --------------------------------------------------------- Note : I have also refered the 'Dragging Text' code from http://zetcode.com/tutorials/monowinformstutorial/dragdrop/ . This also doesn't work when compiled in mono.

View this message in context: winform drag and drop functionality
Sent from the Mono - WinForms mailing list archive at Nabble.com.
_______________________________________________
Mono-winforms-list maillist  -  Mono-winforms-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list
Stifu | 22 Feb 2012 14:13
Picon
Favicon
Gravatar

Re: winform drag and drop functionality

Must be a Mono bug, then. It might be OS specific, but you didn't specify the
OS.

PS: Note that you don't need to recompile your app with Mono in order to run
it with Mono.

savita wrote
> 
> Hi,
> 
> We have developed a drag and drop functionality in .net win form using c#. 
> drag sourse is list box
> drag target is textbox.
> 
> It doesn't give any error when compiled in mono. However the drag and drop
> functionality doesn't work in mono. The text in texbox set as a blank when
> dragged a list item from listbox. It works fine in .net.
> Kindly help and let me know what I am missing.
> 
> I have set the 
> 
> this.textBox1.AllowDrop = true;
> this.listBox1.MouseDown += new
> System.Windows.Forms.MouseEventHandler(this.listBox1_MouseDown);
> this.textBox1.DragDrop += new
> System.Windows.Forms.DragEventHandler(this.textBox1_DragDrop);
> this.textBox1.DragEnter += new
> System.Windows.Forms.DragEventHandler(this.textBox1_DragEnter);
> --------------------------------------------
>  public Form1()
>         {
>             InitializeComponent();
>             listBox1.Items.Add("ABC");
>             listBox1.Items.Add("XYZ");
>             listBox1.Items.Add("AAA");
>         }
> 
>         private void textBox1_DragEnter(object sender, DragEventArgs e)
>         {
>             if (e.Data.GetDataPresent(DataFormats.Text))
>                 e.Effect = DragDropEffects.Copy;
>             else
>                 e.Effect = DragDropEffects.None;
> 
>         }        
> 
>         private void textBox1_DragDrop(object sender, DragEventArgs e)
>         {
> 
>             textBox1.Text =
> (string)e.Data.GetData(DataFormats.StringFormat); ;
>          
>         }
> 
> 
> 
>         private void listBox1_MouseDown(object sender, MouseEventArgs e)
>         {
>             
>             listBox1.DoDragDrop(listBox1.SelectedItem.ToString(),
> DragDropEffects.Copy);
>          
> 
>         }
> ---------------------------------------------------------
> 
> Note : I have also refered the 'Dragging Text' code from
> http://zetcode.com/tutorials/monowinformstutorial/dragdrop/ . This also
> doesn't work when compiled in mono.
> 

--
View this message in context: http://mono.1490590.n4.nabble.com/winform-drag-and-drop-functionality-tp4410189p4410231.html
Sent from the Mono - WinForms mailing list archive at Nabble.com.
_______________________________________________
Mono-winforms-list maillist  -  Mono-winforms-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list

savita | 22 Feb 2012 17:50

Re: winform drag and drop functionality

Thank you for quick reply. 
OS is windows XP.
The application is developed in VS2010. Installed Mono tools for visual
studio 2010 so that we can run the application in mono.
http://www.mono-project.com/GettingStartedWithMonoVS#Download_Mono_for_Windows_to_Run.2FDebug_Locally

Also opened and run the application in monodevelop. Drag and drop
functionality is not working.

--
View this message in context: http://mono.1490590.n4.nabble.com/winform-drag-and-drop-functionality-tp4410189p4410983.html
Sent from the Mono - WinForms mailing list archive at Nabble.com.
_______________________________________________
Mono-winforms-list maillist  -  Mono-winforms-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list

Stifu | 23 Feb 2012 11:36
Picon
Favicon
Gravatar

Re: winform drag and drop functionality

May be this bug: https://bugzilla.novell.com/show_bug.cgi?id=462687
Feel free to repost this bug on the new bugzilla
(https://bugzilla.xamarin.com/) so it gets more attention.

savita wrote
> 
> Thank you for quick reply. 
> OS is windows XP.
> The application is developed in VS2010. Installed Mono tools for visual
> studio 2010 so that we can run the application in mono.
> http://www.mono-project.com/GettingStartedWithMonoVS#Download_Mono_for_Windows_to_Run.2FDebug_Locally
> 
> Also opened and run the application in monodevelop. Drag and drop
> functionality is not working.
> 

--
View this message in context: http://mono.1490590.n4.nabble.com/winform-drag-and-drop-functionality-tp4410189p4413502.html
Sent from the Mono - WinForms mailing list archive at Nabble.com.
_______________________________________________
Mono-winforms-list maillist  -  Mono-winforms-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Gmane