Page 1 of 1

inheritance

Posted: Thu Aug 30, 2007 8:50 am
by jabelshauser
What can i do with inheritance ?
Is there an example ?

Posted: Thu Aug 30, 2007 3:19 pm
by webops
Inheritance is a technique to extend the functionality of an existing class. If you create a class that inherits from an existing Ranorex class, you can add additional functionality by overriding existing members or by creating new properties, methods, and events for the new class.

You can implement your application specific Control or Form classes with inheritance. You can find a simple sample in RanorexProVS2005Sample1:

Code: Select all

public class MyForm : Ranorex.Form
{
    /// <summary>
    /// Initializes a new instance of the MyForm class.
    /// </summary>
    /// <param name="handle"></param>
    public MyForm(IntPtr handle) : base(handle)
    {
    }

    public Button FindButtons(Int32 controlId)
    {
        Button button = base.FindButton(controlId);

        if (button != null)
        {
            Console.WriteLine("FindButton OK");
            button.Enabled = false;
            Application.Sleep(1000);
            button.Enabled = true;
            Application.Sleep(1000);
            Console.WriteLine("FindButton Sleep");
        }
        return button;
    }
}
Jenö
Ranorex Team