GetNextControl() public method

public GetNextControl ( Control ctl, bool forward ) : Control
ctl Control
forward bool
return Control
Example #1
0
		void WalkControls(Control container, Control start, int count, bool forward) {
			Control ctl;

			Console.WriteLine("Walking inside {0},\n starting at control {1}", container.Text, start != null ? start.Text : "null");

			ctl = start;
			for (int i = 0; i < count; i++) {
				ctl = container.GetNextControl(ctl, forward);
				if (ctl != null) {
					Console.WriteLine("{1} GetNextControl returned {0}, Tabindex: {2}", ctl.Text, i+1, ctl.TabIndex);
				} else {
					Console.WriteLine("{0} GetNextControl returned NULL", i+1);
				}
			}
		}
Example #2
0
        // �ҵ�tab˳�����һ���ؼ������DZ�����parent��������Ŀؼ�
        public static Control GetNextControl(
            Control dialog,
            Control start,
            Control parent,
            bool bForward)
        {
            Control next = null;

            while (true)
            {
                next = dialog.GetNextControl(start, bForward);
                if (next == null)
                    break;
                if (next.Parent != parent)
                    break;
                start = next;
            }

            return next;
        }
		public static object CallControlGetNextControl(Control c, object[] obj)
		{
			return c.GetNextControl((Control)(obj[0]), (bool)(obj[1]));
		}
Example #4
0
 public static object CallControlGetNextControl(Control c, object[] obj)
 {
     return(c.GetNextControl((Control)(obj[0]), (bool)(obj[1])));
 }
Example #5
0
		public void TestPublicMethods ()
		{
			// Public Methods that force Handle creation:
			// - CreateControl ()
			// - CreateGraphics ()
			// - GetChildAtPoint ()
			// - Invoke, BeginInvoke throws InvalidOperationException if Handle has not been created
			// - PointToClient ()
			// - PointToScreen ()
			// - RectangleToClient ()
			// - RectangleToScreen ()
			Control c = new Control ();
			
			c.BringToFront ();
			Assert.IsFalse (c.IsHandleCreated, "A1");
			c.Contains (new Control ());
			Assert.IsFalse (c.IsHandleCreated, "A2");
			c.CreateControl ();
			Assert.IsTrue (c.IsHandleCreated, "A3");
			c = new Control ();
			Graphics g = c.CreateGraphics ();
			g.Dispose ();
			Assert.IsTrue (c.IsHandleCreated, "A4");
			c = new Control ();
			c.Dispose ();
			Assert.IsFalse (c.IsHandleCreated, "A5");
			c = new Control ();
			//DragDropEffects d = c.DoDragDrop ("yo", DragDropEffects.None);
			//Assert.IsFalse (c.IsHandleCreated, "A6");
			//Assert.AreEqual (DragDropEffects.None, d, "A6b");
			//Bitmap b = new Bitmap (100, 100);
			//c.DrawToBitmap (b, new Rectangle (0, 0, 100, 100));
			//Assert.IsFalse (c.IsHandleCreated, "A7");
			//b.Dispose ();
			c.FindForm ();
			Assert.IsFalse (c.IsHandleCreated, "A8");
			c.Focus ();
			Assert.IsFalse (c.IsHandleCreated, "A9");

			c.GetChildAtPoint (new Point (10, 10));
			Assert.IsTrue (c.IsHandleCreated, "A10");
			c.GetContainerControl ();
			c = new Control ();
			Assert.IsFalse (c.IsHandleCreated, "A11");
			c.GetNextControl (new Control (), true);
			Assert.IsFalse (c.IsHandleCreated, "A12");
#if NET_2_0
			c.GetPreferredSize (Size.Empty);
			Assert.IsFalse (c.IsHandleCreated, "A13");
#endif
			c.Hide ();
			Assert.IsFalse (c.IsHandleCreated, "A14");
			c.Invalidate ();
			Assert.IsFalse (c.IsHandleCreated, "A15");
			//c.Invoke (new InvokeDelegate (InvokeMethod));
			//Assert.IsFalse (c.IsHandleCreated, "A16");
			c.PerformLayout ();
			Assert.IsFalse (c.IsHandleCreated, "A17");
			c.PointToClient (new Point (100, 100));
			Assert.IsTrue (c.IsHandleCreated, "A18");
			c = new Control ();
			c.PointToScreen (new Point (100, 100));
			Assert.IsTrue (c.IsHandleCreated, "A19");
			c = new Control ();
			//c.PreProcessControlMessage   ???
			//c.PreProcessMessage          ???
			c.RectangleToClient (new Rectangle (0, 0, 100, 100));
			Assert.IsTrue (c.IsHandleCreated, "A20");
			c = new Control ();
			c.RectangleToScreen (new Rectangle (0, 0, 100, 100));
			Assert.IsTrue (c.IsHandleCreated, "A21");
			c = new Control ();
			c.Refresh ();
			Assert.IsFalse (c.IsHandleCreated, "A22");
			c.ResetBackColor ();
			Assert.IsFalse (c.IsHandleCreated, "A23");
			c.ResetBindings ();
			Assert.IsFalse (c.IsHandleCreated, "A24");
			c.ResetCursor ();
			Assert.IsFalse (c.IsHandleCreated, "A25");
			c.ResetFont ();
			Assert.IsFalse (c.IsHandleCreated, "A26");
			c.ResetForeColor ();
			Assert.IsFalse (c.IsHandleCreated, "A27");
			c.ResetImeMode ();
			Assert.IsFalse (c.IsHandleCreated, "A28");
			c.ResetRightToLeft ();
			Assert.IsFalse (c.IsHandleCreated, "A29");
			c.ResetText ();
			Assert.IsFalse (c.IsHandleCreated, "A30");
			c.SuspendLayout ();
			Assert.IsFalse (c.IsHandleCreated, "A31");
			c.ResumeLayout ();
			Assert.IsFalse (c.IsHandleCreated, "A32");
#if NET_2_0
			c.Scale (new SizeF (1.5f, 1.5f));
			Assert.IsFalse (c.IsHandleCreated, "A33");
#endif
			c.Select ();
			Assert.IsFalse (c.IsHandleCreated, "A34");
			c.SelectNextControl (new Control (), true, true, true, true);
			Assert.IsFalse (c.IsHandleCreated, "A35");
			c.SetBounds (0, 0, 100, 100);
			Assert.IsFalse (c.IsHandleCreated, "A36");
			c.Update ();
			Assert.IsFalse (c.IsHandleCreated, "A37");
		}
Example #6
0
			public static string TestControl(Control container, Control start, bool forward) {
				Control ctl;

				ctl = container.GetNextControl(start, forward);

				if (ctl == null) {
					return null;
				}

				return ctl.Text;
			}
 private static Control GetPreviousControl(Control parentControl, Control currentControl)
 {
     return parentControl.GetNextControl(currentControl, false);
 }
 private static Control GetNextControl(Control parentControl, Control control)
 {
     return parentControl.GetNextControl(control, true);
 }
Example #9
-1
		bool TestControl(Control container, Control start, bool forward, string expected) {
			bool	result;
			Control	ctl;

			ctl = container.GetNextControl(start, forward);

			if (ctl == null && expected == null) {
				if (verbose > 0) {
					Console.WriteLine("Test {0} passed (GetNextControl)", test_no++);
				}
				return true;
			}

				

			if (ctl == null || ctl.Text != expected) {
				result = false;
				if (verbose > 0) {
					Console.WriteLine("Test {0} failed (GetNextControl):\n   Container: {1}\n   Start: {2}\n   Forward: {3}\n   Expected: {4}\n   Got: {5}",
						test_no, container.Text, start.Text, forward, expected, ctl != null ? ctl.Text : "null");
				}

				if (exception) {
					throw new Exception("Test " + test_no + " failed (GetNextControl)");
				}

				test_no++;
				failed++;
			} else {
				if (verbose > 0) {
					Console.WriteLine("Test {0} passed (GetNextControl)", test_no++);
				}
				result = true;
			}

			return result;
		}