How Do I Set Up One Push Button to Affect Either the Subform or its Parent Task? (Magic xpa 4.x)
Sometimes a given push button can be expected to do different things, depending on where the current focus is. For instance, if you have a parent task that is sitting on a list of records, and each record has some child records, a “delete” button would be expected to delete the parent record or the child record, depending on where the cursor was parked.
For instance, in the example above, if the “Delete” key is pressed, should that refer to the “XXX” record, or the “CCC” record? The user would probably expect that since the cursor is on “XXX”, that the parent record will be deleted (along with all its children). However, this is actually forcing the push button to do double duty, depending on where the cursor is parked.
Magic xpa has a property to handle this, which is called Raise at. It has two values:
-
Container Task: the event will trigger in the task that has the push button.
-
Task in focus: the event will trigger in either the parent task or the subtask, depending on which has the focus.
Task in focus will do exactly what we need in this instance.
Note: The Task in focus option is only applicable for non-parkable buttons (Allow Parking=False).
-
Go to the push button you need to alter.
-
For the Raise at property, select Task in focus.
Now, the event will be raised at either the parent or the child task, depending on which currently is in focus.
The Online and Rich Client Samples projects (program HG29 and RHG29)