Salesforce

How Do I Implement Logic with Push Buttons? (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Implement Logic with Push Buttons? (Magic xpa 3.x)

There are several steps to implementing logic with push buttons:

  1. Create you user events

  2. Put your push buttons on the form

  3. Create a logic unit to perform the desired logic when the event is raised.

Let’s see how to do each of these steps.

1. Create your user event

First, you need to create you user events. You do this in User Events (Ctrl+U). Press F4 to open up a line, and fill in the fields as follows:

  1. In the Description column, give the event any name you like.

  2. Select None for the Trigger type. You don’t need a trigger since this event will be raised by the push button directly.

  3. For Force Exit, you will usually want Editing or None. Force exit = Editing causes the value in the edit field to be saved into the variable before the push button is pressed, which is generally what you want.

Enter as many events as you need for your push buttons.

Note: You can also just reuse global events. In the example above, the global events are marked with the prefix “ge.”. We have some standard global events that we use in many programs, such as ge.Print and ge.Start. If you use global events, you can even attach them to models, so you can automatically create buttons that raise the desired event.

2. Put your push buttons on the form

  1. Drag the Push Button control from the Toolbox and drop it on your form.

  2. Resize it as needed.

  3. In the push button Control properties, type in the Format. This will be the text that displays on the push button.

  4. In the push button Control properties, zoom from the Event Type property, select Internal and from the Event property select your event.

Now, when the user presses the push button the event will be raised. In our example, when the user presses the Display Message button, the event e.Display Message will be raised. Now we need to create a logic unit to handle the event.

Create a logic unit to perform the desired logic when the event is raised

  1. Go to the Logic tab.

  2. Press Ctrl+H to open up a header line.

  3. From the combo box, select Event (or type E). An event box will appear.

  4. Select Event type: User, then tab.

  5. An event list will appear. Choose your desired event.

  6. Use the lines under the Event logic unit to add operations that will be performed when the event is raised.

Now you have an operational push button.

Note: In our example, we used a non-tabbable push button. You can also attach push buttons to variables so you can tab to them, by specifying the variable in the Data control property. When you do that, the Format property needs to be specified slightly differently, because the Format actually becomes a Picture for the data field. See How Do I Allow Keyboard Navigation to a Push Button?.

See also

The Online and Rich Client Samples projects (program HG23 and RHG23)

Reference
Attachment 
Attachment