TBC Macros and Extensions1

 View Only

03 Configuring Your Visual Studio Project 

05-01-2018 11:56

The Macro SDK template contains all of the structure and configurations you need to get started. These include:

  • Links to program DLLs
  • Environments and references
  • Setup for debugging

Making TBC Controls Available in Your VS Project

  1. In Visual Studio's Solution Explorer pane (on the right), open the MyFirstMacro.xaml file..

  2. On the left side of the screen, click Toolbox.

  3. Click the pin icon at the top of the pane so it stays open for the next steps.

  4. In the Toolbox pane, right-click All WPF Controls, and select Choose Items.

  5. Click the WPF Components tab and then click Browse.

  6. Navigate to C:\Program Files (x86)\Trimble\Macros SDK\, and select Trimble.Vce.UI.Controls.dll.

  7. In the Choose Toolbox Items dialog, you will now see the custom TBC controls highlighted.

  8. Click OK. Notice the TBC custom controls at the bottom on the All XAML Controls list now.

  9. Press F5 to refresh the project.

  10. Double-click one of the custom controls to add all of the custom controls DLLs as references.

Adding Controls to the UI

You can create user interfaces for your apps by dragging controls from the Toolbox and setting properties in the Properties window.

  1. Select Project > Add New Item > IronPython WPF Window, and click Add to open a new XAML file.If the graphical Designer window does not open, right-click the .xaml file in the Solution Explorer, and select Include in Project to open it.

  2. At the bottom of the graphic view, click the Vertical Split icon so you can see both the source and Designer side by side.

  3. In the source view, type <Label Content=”Hello world”/> between <Grid> and </Grid> to see it appear in the Designer view.

  4. Click-and-drag several of the WPF and TBC custom controls into the view as well. This is how you layout a command's UI. Notice how code for each control is added to the right pane as you do this.

  5. Use the center grip to position the control and the corner and side grips to resize the control.

  6. To add more controls, type the beginning of the control name and select the appropriate tag. For example, type <checkb... You will see Intellisense offer suggested tags. Select CheckBox and then Content.

    Note: You can press Enter when the auto-fill (Intellisense) suggests the correct tag. Note: If you are not receiving Intellisense prompts as you type, you may need to add a WPF project or reference a 32-bit version of TBC. Note: You can add code to say what the state of the checkbox does in terms of operations. If you want enabled/checked to be the default for a checkbox, add the code.

    IsChecked="true"

    The Designer offers many more controls you can use. This shows how easy it is to add UI, especially if the commands are written in WPF.

  7. If you open the associated .py file, you can see where the corresponding .xaml file is referenced under class.

  8. Close the tab when you are done experimenting.

Next topic: 04 Familiarizing Yourself with the Predefined Macros

Statistics
0 Favorited
323 Views
0 Files
0 Shares
0 Downloads

Comments

01-09-2024 14:00

Hello David. I noticed this was first published 05-01-2018. Would you be able to update the documentation along with screenshots?

07-26-2022 19:07

When I try to add "Trimble.Vce.UI.Controls.dll" I get the following error...

"There are no components in 'C:\Program Files(x86)\Trimble\Macros SDK\Trimble.Vce.Ui.Controls.dll" that can be placed on the toolbox."

05-10-2022 14:01

I have everything installed and am in the ironpython environment, but there is no ironpython WPF window under the "Add New Item" list. Just a bunch of python stuff, nothing with ironpython even shows up.

02-18-2020 18:03

Hi,

 

On the right double click on:

 

 

Two windows should appear:

 

 

When XAML window is active, "All WPF controls will appear" in the Toolbox on the left:

 

 

That's where you should right click and follow the list you cited.

12-10-2019 09:30

Hello Good TBC Community,

 

I'm stucked at these steps of the process, 

 

I just can't figure out what to do on VS.

 

Can anybody help me with this?

 

Regards

05-14-2019 00:53

Hi Gary,

Your method was useful!
Thanks!

05-13-2019 09:59

"F5" starts the debugger. You need to change the Python Environment to IronPython. At the top of Visual Studio where is says "Python 3.7 (64 bit)", change the environment to "IronPython (32 bit)". If IronPython is not listed there, you need to install it. (IronPython ) (Just download the MSI file)

05-13-2019 05:16

When I  Press F5 to refresh the project.

VS 2019 popup prompt:


What is the reason for this?

Related Entries and Links

No Related Resource entered.