Skip to content

Mapping a button to a function

jlee627 edited this page Oct 11, 2019 · 5 revisions

Mapping a button to a function

This will be illustrated using an example function that changes window size

  • Step 1: Click on the "Events" menu, and check the "Click" checkbox

  • Step 2: Click on the "Code" menu at the top, then select the "Logic" tab on the left

  • Step 3: Create your function within the "Logic" section, the following is an example of what one might look like function Resize-Window { param($Window) $Window.ClientSize = '800,800' }

  • Step 4: Click on the "Designer" menu at the top then go to the "Events" menu, and click on the "<>" symbol next to the "Click" checkbox

  • Step 5: Type: "Resize-Window -Window $Form" into the textbox | (Resize-Window is our function, -Window is our argument name within the function, $Form is the argument we pass into the function)

  • Step 6: Click on "Code" menu, then click on "Logic" tab and delete the procedurally generated line of text inserted at the top"function Resize-Window -Window $Form { }"