[Mono-bugs] [Bug 74744][Nor] New - CurrencyManager does not fire PositionChanged event
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Tue, 26 Apr 2005 15:25:40 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by jordi@ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=74744
--- shadow/74744 2005-04-26 15:25:40.000000000 -0400
+++ shadow/74744.tmp.13352 2005-04-26 15:25:40.000000000 -0400
@@ -0,0 +1,127 @@
+Bug#: 74744
+Product: Mono: Class Libraries
+Version: 1.0
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Windows.Forms
+AssignedTo: jackson@ximian.com
+ReportedBy: jordi@ximian.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: CurrencyManager does not fire PositionChanged event
+
+The following sample (without any user interaction) fires the
+listBox_DataManagerPositionChg handeler on MS Net when setting Position to
+a value. In our implementation, it does not happen. It also happens for
+PositionChanged.
+
+I belive that it has to do with how we deal with onCurrentChangedHandler,
+onPositionChangedHandler and CurrentChanged, PositionChanged events.
+
+Sample code:
+
+using System.Windows.Forms;
+using System.Drawing;
+using System;
+using System.Collections;
+
+namespace MyFormProject
+{
+
+ public class ourListBox : ListBox
+ {
+ public ourListBox () : base ()
+ {
+
+ }
+
+ public CurrencyManager _DataManager {
+ get { return DataManager; }
+ }
+ }
+
+ // Data container
+ public class Simbols
+ {
+ private string simbol;
+ private string descripcio;
+
+ public Simbols (string descripcio, string simbol)
+ {
+ this.simbol = simbol;
+ this.descripcio = descripcio;
+ }
+
+ public string Simbol {
+ get { return simbol;}
+ }
+
+ public string Descripcio {
+ get { return descripcio; }
+ }
+
+ public string DescripcioLlarga {
+ get { return descripcio; }
+ }
+
+ public override string ToString ()
+ {
+ return descripcio + " / " + simbol;
+ }
+ }
+
+ class MainForm : System.Windows.Forms.Form
+ {
+
+ public MainForm ()
+ {
+
+ ourListBox listBox = new ourListBox ();
+ Controls.Add (listBox);
+
+ /* Data */
+ ArrayList simbols = new ArrayList ();
+ simbols.Add (new Simbols ("Fons Monetari Internacional", "FMI"));
+ simbols.Add (new Simbols ("Centimetre", "cm")) ;
+ simbols.Add (new Simbols ("Ferrocarril", "FC"));
+ simbols.Add (new Simbols ("Megahertz", "MHz")) ;
+ simbols.Add (new Simbols ("pesseta", "PTA"));
+ simbols.Add (new Simbols ("quilogram", "kg"));
+ simbols.Add (new Simbols ("watt", "W"));
+
+ /* ListBox */
+ listBox.Location = new Point (20, 16);
+ listBox.Size = new Size (250, 130);
+
+ listBox.DataSource = simbols;
+ listBox.DisplayMember = "Descripcio";
+ listBox.ValueMember = "Simbol";
+
+ listBox._DataManager.PositionChanged += new EventHandler
+(listBox_DataManagerPositionChg);
+ listBox._DataManager.Position = 2;
+
+
+ ClientSize = new Size (600, 600);
+ }
+
+
+ private void listBox_DataManagerPositionChg (object sender,
+System.EventArgs e)
+ {
+ Console.WriteLine ("listBox_DataManagerPositionChg");
+ }
+
+ public static void Main(string[] args)
+ {
+ Application.Run (new MainForm ());
+ }
+ }
+
+}