Previous Topic: Add the LiteralsNext Topic: Add Procedure Step Use Statement


Add the Push buttons

We will now add the two push buttons and their associated events and logic.

Follow these steps:

  1. From the Menu Bar select Add, then select Push Button…. In the Push Button Properties Text: entry field enter <Back>. For the back Button Action, we want to perform a special action. Select the Special Action radio button and in the drop-down list select Cancel – Close without Execution. This will close the current dialog and take us back to the originating dialog. Select the OK push button on the Push Button Properties dialog and place the button as shown in the example.
  2. If you have multiple adds turned on, you can continue and add the next push button. Otherwise, from the Menu Bar select Add, then select Push Button…. In the Push Button Properties Text: entry field enter <Next>. Check the Is the Default Push Button check box.
  3. For the next Button Action, we want to execute an event. Select the Events… push button. In the Event processing dialog, select the Add push button to let the Toolset generate a new click event for the push button. Notice the event name and then select the Close push button. Select the OK push button on the Push Button Properties dialog and place the button as shown in the example.
  4. Resize one of the buttons making it slightly less tall. Then, with focus still on the resized button, click the other push button while holding down the Ctrl key. Then, from the Menu Bar select Edit, and then select Position…. Then select Equal Height and Equal Width, select Align Horizontally Bottom, select Separate Horizontally by a Distance: of 20, select Move Horizontally Center, and then select the OK push button.
  5. For the back push button, we just performed a special action. For the next push button, we want to actually call the Maintain Golfer server to register the golfer. To open the procedure step action diagram, from the Toolbar select the Action Diagram Open the ADD GOLFER Action Diagram icon. If the icon is not enabled, make sure you have one of the dialogs selected in the Navigation Diagram.
  6. We only want to register the golfer if the two passwords that were entered match.

    This brings up another interesting topic. Where should this type of validation be performed? Should it be in the client procedure step, as we are about to put it? Should it be in the server procedure step? Alternatively, more likely, should it be in the elementary process?

    If you want the same business rule to apply regardless of who performs the transaction, or where, when or how the transaction is performed, then you would probably want the validation to be in the elementary process. If the rules can vary for any of the reasons specified earlier, then you will likely want the rules in the client procedure step.

    For example, in this particular case we are allowing golfers to register themselves online. When the golfers do that, we do not want them to enter their password incorrectly, so we make them enter it twice. But we can also have a batch procedure in which we get feeds from local golf clubs, pro shops, and sporting goods stores where we set up prospects with some common password, like their last name, or the store name from which we got the feed, and then email them and invite them to login, change their password, and enter their scores. We can set the password differently depending on how we set them up. In such a case, it would make more sense to place the validation rules in the different procedure steps, online versus batch. We are going to put the check here in the client procedure.

    In the procedure step action diagram, from the Tool Palette select the If push button and with the cursor (which now resembles a crosshair), select the event handler EVENT ACTION egolfer_reg_pb_next_click. Then in the Add Statement panel, select the expression attribute view, select the entity view import golfer, select the attribute password, select the operator IS EQUAL TO, select the expression character view, select the entity view import confirmation golfer, and then select the Add push button.

  7. If the golfer passes the test, then we want to set the system attribute Command to register and then call the server procedure step. With the If statement still highlighted, from the Menu Bar select Edit, then select Add Statement…. Then select Command is…, select the expression command value, select the command REGISTER, select the OK push button, and then select the Add push button.