Canvas > Using Canvas > Getting Started with Canvas

Getting Started with Canvas

Once you are ready to create some screens, you can try a variety of options to experiment with Canvas, including but not limited to the following:

To Make a Simple Screen

  1. Create a new Canvas Screen.
  2. Open a Toolbox pane to select some controls.
  1. Drag a text tool onto your screen.
  2. Drag a button onto your screen.
  1. Open a Properties pane to reset some control properties.
  1. Rename the text tool and assign its text.
  1. Click the text tool to view its properties.
  2. Find the control Name, below the Properties header, and rename it, for example, TextTime.
  3. Find the Text property of the text tool and type the desired text into the text field to give it a new value, for example, NoTimeYet.
  1. Rename the button tool and assign its text.
  1. Click the button to view its properties.
  2. Find the control Name, below the Properties header, and rename it, for example, ButtonTime.
  3. Find the Button text property of the button and type the desired text into the text field to give it a new value, for example, GetTime.
  1. Open an Events pane to assign an event.
  1. Click the button to view its events.
  2. Find the Click event and click the check box to enable the event. The Script view opens, with the cursor in the click event section of script.
  3. In the script view, set what you want the text field to show (the current time) when the button click event is called. To do so, type the following line of code:

Objects.TextTime.Text = DateTime.Now.ToString();

  1. Validate your script.
  2. Save the screen you just made.
  3. Run the screen and see how your button works.

To Retrieve CygNet Data

  1. Create a new Canvas screen
  2. Open a Toolbox pane.
  1. Open a Properties pane.
  1. Save the screen.
  2. Run the screen and see how the value has updated.

Once you've started getting comfortable with the Canvas basics, you might want to try some more advanced options. In Canvas you can choose to use outside assemblies, such as CygNet COM or .NET API library files, using the Canvas Assembly Manager to link to a selected DLL folder location.

To Link to an External or Custom API

  1. Use the Canvas Assembly Manager to locate and link to your target .dll file.
  2. Once an assembly is linked, it is available for use in scripting your screens.

If you'd like to get even more adventurous, you can try building your own Canvas controls using our Canvas Custom Control framework.

To Build Your Own Custom Controls

To Start Canvas Via the Command Line

See Starting Canvas from a Command Line for more information.


Let us know how we can improve this topic.

CygNet at weatherford.com

© 2020 Weatherford. All rights reserved.