Using the MessageBoxControl in Mashup Designer

Aug 31 2015

The new Mashup MessageBoxControl was introduced by Karin in the Smart Office Blog with the release of ISO 10.0.5.2 last year. Here we provide some more details on how the control can be used in Mashups.

Six different message types are available for use with the MessageBoxControl. Define one of the following MessageType values for the MessageBoxControl:

Information MessageType

Information is the default MessageType when no MessageType has been set. It includes one button for OK.

Information MessageType

 

The XAML code will look as follows:

   <mashup:MessageBoxControl Grid.Row="0" Grid.Column="0" Name="MainWindowMessageBoxControl">
       <mashup:MessageBoxControl.Events>
          <mashup:Events>
             <mashup:Event SourceName="ItemMIPanel" SourceEventName="UpdateComplete" TargetEventName="Show">
                <mashup:Parameter TargetKey="MessageType" Value="Information" />
                <mashup:Parameter TargetKey="Message" Value="Item {ITNO} created" />
                <mashup:Parameter TargetKey="Header" Value="Information" />
                <mashup:Parameter TargetKey="IsStatusBarMessage" Value="0" />
                <mashup:Parameter TargetKey="IsDialogMessage" Value="1" />
             </mashup:Event>
          </mashup:Events>
       </mashup:MessageBoxControl.Events>
    </mashup:MessageBoxControl>

 

Success MessageType

The Success MessageType has a single button for OK.

Success MessageType
Success MessageType

 

Error MessageType

The Error MessageType has a single button for OK. A Cancel button can also be added with the IsCancelAllowed parameter.

<mashup:Parameter TargetKey="IsCancelAllowed" Value="1" />
Error MessageType
Error MessageType

 

Warning MessageType

The Error MessageType has a single button for OK. A Cancel button can also be added with the IsCancelAllowed parameter.

Warning MessageType
Warning MessageType

 

Question MessageType

The Question MessageType has two buttons for Yes and No.

Question MessageType
Question MessageType

 

Save MessageType

The Save MessageType has two buttons for Yes and No.

Save MessageType
Save MessageType

Messages will be shown by default in both a pop-up box and on the Status Bar, although only pop-up messages can accept a response. Set IsStatusBarMessage to 0 for a pop-up only or IsDialogMessage to 0 for a status message only.

The user’s selection can be retrieved in the MessageBoxControl Closed event from the Result parameter, which returns the content of the button selected. Alternatively, parameters BoolResult (“True” or “False”) and NumericResult (“1” or “0”) are also returned.

Here is a simple example of an MMS200MI/AddItmBasic call where the button now triggers a Warning on any Status greater than or equal to 20. If the user clicks OK, the AddItemBasic transaction is still processed. If Cancel is selected, the transaction is skipped.

<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ui="clr-namespace:Mango.UI.Controls;assembly=Mango.UI" xmlns:mashup="clr-namespace:Mango.UI.Services.Mashup;assembly=Mango.UI" xmlns:m3="clr-namespace:MForms.Mashup;assembly=MForms">
    <Grid.Resources></Grid.Resources>
    <Grid.ColumnDefinitions>
       <ColumnDefinition Width="1*" />
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
       <RowDefinition Height="1*" />
    </Grid.RowDefinitions>
    <!-- MMS200MI / AddItmBasic panel -->
    <m3:MIPanel Grid.Row="0" Grid.Column="0" Name="ItemMIPanel">
       <m3:MIPanel.DataSource>
          <m3:MIDataSource Program="MMS200MI" Transaction="AddItmBasic" Type="Create" InputFields="STAT,ITNO,ITDS,RESP,UNMS,ITTY,MABU,PRVG,ITGR,ITCL" />
       </m3:MIPanel.DataSource>
       <Grid>
          <Grid.ColumnDefinitions>
             <ColumnDefinition Width="Auto" />
             <ColumnDefinition Width="10" />
             <ColumnDefinition Width="200" />
             <ColumnDefinition Width="15" />
             <ColumnDefinition Width="Auto" />
             <ColumnDefinition Width="10" />
             <ColumnDefinition Width="200" />
             <ColumnDefinition Width="15" />
             <ColumnDefinition Width="*" />
          </Grid.ColumnDefinitions>
          <Grid.RowDefinitions>
             <RowDefinition Height="Auto" />
             <RowDefinition Height="5" />
             <RowDefinition Height="Auto" />
             <RowDefinition Height="5" />
             <RowDefinition Height="Auto" />
             <RowDefinition Height="5" />
             <RowDefinition Height="Auto" />
             <RowDefinition Height="5" />
             <RowDefinition Height="Auto" />
             <RowDefinition Height="Auto" />
          </Grid.RowDefinitions>
          <Label Content="Status:" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0" Padding="0" />
          <TextBox Name="StatusTextBox" MaxLength="2" Text="{Binding [STAT]}" Grid.Row="0" Grid.Column="2" HorizontalAlignment="Stretch" VerticalAlignment="Center" />
          <Label Content="Item number:" Grid.Row="0" Grid.Column="4" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0" Padding="0" />
          <TextBox MaxLength="15" Text="{Binding [ITNO]}" Grid.Row="0" Grid.Column="6" HorizontalAlignment="Stretch" VerticalAlignment="Center" />
          <Label Content="Name:" Grid.Row="2" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0" Padding="0" />
          <TextBox MaxLength="30" Text="{Binding [ITDS]}" Grid.Row="2" Grid.Column="2" HorizontalAlignment="Stretch" VerticalAlignment="Center" />
          <Label Content="Responsible:" Grid.Row="2" Grid.Column="4" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0" Padding="0" />
          <TextBox MaxLength="10" Text="{Binding [RESP]}" Grid.Row="2" Grid.Column="6" HorizontalAlignment="Stretch" VerticalAlignment="Center" />
          <Label Content="Basic unit of measure:" Grid.Row="4" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0" Padding="0" />
          <TextBox MaxLength="3" Text="{Binding [UNMS]}" Grid.Row="4" Grid.Column="2" HorizontalAlignment="Stretch" VerticalAlignment="Center" />
          <Label Content="Item type:" Grid.Row="4" Grid.Column="4" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0" Padding="0" />
          <TextBox MaxLength="3" Text="{Binding [ITTY]}" Grid.Row="4" Grid.Column="6" HorizontalAlignment="Stretch" VerticalAlignment="Center" />
          <Label Content="Make/buy code:" Grid.Row="6" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0" Padding="0" />
          <TextBox MaxLength="3" Text="{Binding [MABU]}" Grid.Row="6" Grid.Column="2" HorizontalAlignment="Stretch" VerticalAlignment="Center" />
          <Label Content="Commission group:" Grid.Row="6" Grid.Column="4" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0" Padding="0" />
          <TextBox MaxLength="15" Text="{Binding [PRVG]}" Grid.Row="6" Grid.Column="6" HorizontalAlignment="Stretch" VerticalAlignment="Center" />
          <Label Content="Item group:" Grid.Row="8" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0" Padding="0" />
          <TextBox MaxLength="15" Text="{Binding [ITGR]}" Grid.Row="8" Grid.Column="2" HorizontalAlignment="Stretch" VerticalAlignment="Center" />
          <Label Content="Product group:" Grid.Row="8" Grid.Column="4" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0" Padding="0" />
          <TextBox MaxLength="15" Text="{Binding [ITCL]}" Grid.Row="8" Grid.Column="6" HorizontalAlignment="Stretch" VerticalAlignment="Center" />
          <StackPanel Grid.Row="10" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,15,0,0" Grid.ColumnSpan="7">
             <Button Content="{mashup:Constant Key=Save,File=Mango.UI}" Width="150" VerticalAlignment="Center">
                <Button.CommandParameter>
                   <mashup:Events>
                      <!-- MIPanel Button-Click Event - Item Status Warning MessageBoxControl -->
                      <mashup:Event TargetName="MainWindowMessageBoxControl" SourceEventName="Click" TargetEventName="Show">
                         <mashup:Event.Conditions>
                            <mashup:Conditions>
                               <mashup:Condition SourceValue="{Binding ElementName=StatusTextBox, Path=Text}" TargetValue="20" Operator="GreaterThanOrEqual" Type="Numeric" />
                            </mashup:Conditions>
                         </mashup:Event.Conditions>
                         <mashup:Parameter TargetKey="MessageType" Value="Warning" />
                         <mashup:Parameter TargetKey="Message" Value="Status should be less than 20" />
                         <mashup:Parameter TargetKey="Header" Value="Warning" />
                         <mashup:Parameter TargetKey="IsDialogMessage" Value="1" />
                         <mashup:Parameter TargetKey="IsStatusBarMessage" Value="0" />
                         <mashup:Parameter TargetKey="IsCancelAllowed" Value="1" />
                      </mashup:Event>
                   <!-- MIPanel Button-Click Event - AddItmBasic when no Warning activated -->
                      <mashup:Event TargetName="ItemMIPanel" SourceEventName="Click" TargetEventName="Create">
                         <mashup:Event.Conditions>
                            <mashup:Conditions>
                               <mashup:Condition SourceValue="{Binding ElementName=StatusTextBox, Path=Text}" TargetValue="20" Operator="LessThan" Type="Numeric" />
                            </mashup:Conditions>
                         </mashup:Event.Conditions>
                      </mashup:Event>
                   </mashup:Events>
                </Button.CommandParameter>
             </Button>
          </StackPanel>
       </Grid>
    </m3:MIPanel>
 <!-- Item Status Warning MessageBoxControl -->
    <mashup:MessageBoxControl Grid.Row="0" Grid.Column="0" Name="MainWindowMessageBoxControl">
       <mashup:MessageBoxControl.Events>
          <mashup:Events>
             <!-- MessageBoxControl-Closed Event - call AddItmBasic unless user takes Cancel button on Warning MessageBoxControl -->
             <mashup:Event SourceEventName="Closed" TargetName="ItemMIPanel" TargetEventName="Create">
                <mashup:Event.Conditions>
                   <mashup:Conditions>
                      <mashup:Condition SourceKey="Result" TargetValue="Cancel" Operator="NotEqual" />
                   </mashup:Conditions>
                </mashup:Event.Conditions>
             </mashup:Event>
          </mashup:Events>
       </mashup:MessageBoxControl.Events>
    </mashup:MessageBoxControl>
 </Grid>

 

Special thanks to Michael Edmonds from Zodiac for his research on the different MessageTypes available from the new MessageBoxControl!

 

 

 

We write about Infor technology, ERP & Cloud news plus host the occasional Webinar.

Get it delivered to your inbox

subscribe
X

Subscribe

Subscribe to ComActivity Newsletter – Infor technology, ERP & Cloud news plus host the occasional Webinar.


Add us to your LinkedIn feed

@ Copyright 2024. All rights reserved.