Item event handler executed twice

SAP BO 2004A, C#, UI+DI
Hi,
inside an item event handler, a piece of code stores some data in database using RecordSet.Query( "INSERT INTO ..." )
Running the application, the insert statement is executed twice, what I don't expect.
If I add a messagebox after the Query()-statement, the code is executed only once.
Also if I set a breakpoint in debugger, the code is executed only for one time.
I checked allways the following things:
1) itemEvent.beforeAction == true
2) the SAPbouiCOM.Application object is instanciated only for one time.
Any ideas? Thank you!
Peter

Are you filtering?
It's imperitive that you filter your events. This way your add-on will only receive the events you are interested in...
This will also allow the SBO -> add-on communication to be more efficient and faster...

Similar Messages

  • MenuBar Menu Items Events?

    Hi
    I have just started playing with Flex 2 Builder and I have
    built a simple
    app to get my feet wet. I have a menubar at the top of my app
    with three
    menus each with three choices
    MENU1
    SUB1A
    SUB1B
    SUB1C
    MENU2
    SUB2A
    SUB2B
    SUB2C
    MENU3
    SUB3A
    SUB3B
    SUB3C
    My problem is that there does not seem to be a way to access
    the sub menu
    items and assign events to each. When I put an onClick event
    in the
    <mx:MenuBar> it fires regardless of which submenu item
    I choose.
    Is there a way, or what is the best way, to create individual
    events for
    each submenu? Additionally, can I add additional elements to
    my <menuitem>
    tags such as <menuitem label="SUB3A" someValue="XYZ">
    and then access
    "someValue" from whatever event I get to fire when the sub
    menu is clicked?
    Thanks
    Rich

    Hi --
    Thanks for this example. This should really help me out.
    Rich
    "ntsiii" <[email protected]> wrote in message
    news:e8bnbt$2lk$[email protected]..
    > When the event fires, the event object passed into the
    handler can be used
    > to
    > access the item that created the menu option. You can
    use information in
    > the
    > item to decide what action to take. Here is a simple
    example:
    >
    > Tracy
    >
    > <?xml version="1.0"?>
    > <!-- Simple example to demonstrate the MenuBar
    control. -->
    > <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    > creationComplete="initCollections();" >
    >
    > <mx:Script>
    > <![CDATA[
    >
    > import mx.events.MenuEvent;
    > import mx.controls.Alert;
    > import mx.collections.*;
    >
    > [Bindable]
    > public var menuBarCollection:XMLListCollection;
    >
    > private var menubarXML:XML =
    > <root>
    > <menuitem label="Menu1">
    > <menuitem label="MenuItem 1-A" data="1A"/>
    > <menuitem label="MenuItem 1-B" data="1B"/>
    > </menuitem>
    > <menuitem label="Menu2">
    > <menuitem label="MenuItem 2-A" type="check"
    > data="2A"/>
    > <menuitem type="separator" />
    > <menuitem label="MenuItem 2-B" >
    > <menuitem label="SubMenuItem 3-A" type="radio"
    > groupName="one" data="3A"/>
    > <menuitem label="SubMenuItem 3-B" type="radio"
    > groupName="one" data="3B"/>
    > </menuitem>
    > </menuitem>
    > </root>;
    >
    > // Event handler for the MenuBar control's change event.
    > private function menuHandler(event:MenuEvent):void
    > {
    > Alert.show("Label: " + event.item.@label + "Data: " +
    > event.item.@data, "Clicked menu item");
    > }
    >
    > // Event handler to initialize the MenuBar control.
    > private function initCollections():void
    > {
    > menuBarCollection = new
    > XMLListCollection(menubarXML.children());
    > }
    > ]]>
    > </mx:Script>
    >
    > <mx:Panel title="MenuBar Control Example"
    height="75%" width="75%"
    > paddingTop="10" paddingLeft="10">
    >
    > <mx:MenuBar labelField="@label"
    change="menuHandler(event);"
    > dataProvider="{menuBarCollection}" />
    >
    > </mx:Panel>
    > </mx:Application>
    >
    >

  • Correct way to use an event handler

    The following is dynamically adds a series of buttons and a label to each button. The problem is that the event handler fires twice for each button, and the last button never gets processed at all.
    Should I be using a different event handler than ResizeEvent.RESIZE? How do I add the label to the last button in the sequence?
    Thank you.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
        <mx:Script>
      <![CDATA[
          import mx.events.ResizeEvent;
    private var button:Button2;
    public var numButtons:Number=5;
    private var counter:Number=0;
    public function init():void{
        for(var i:int=0; i<numButtons;i++){
            button=new Button2;
            hbox.addChild(button)
            button.addEventListener(ResizeEvent.RESIZE, handleButtonAdded)
    private function handleButtonAdded(e:ResizeEvent):void{
        counter++
        trace(e.target)
        e.target.label= String(counter);
        button.removeEventListener(ResizeEvent.RESIZE, handleButtonAdded)
      ]]>
    </mx:Script>
    <mx:HBox id="hbox"  horizontalGap="0"/>
    </mx:Application>
    Here's the button: Button2.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Button xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()" >
    <mx:Script>
        <![CDATA[
        public function init():void{
            this.width=100;
        ]]>
    </mx:Script>
    </mx:Button>

    Hmm , what are you trying to do ?  There are a few questionable things happening.  Your event-handler is named "handleButtonAdded" but it takes a ResizeEvent ? Do you mean to trigger an event based on when the button was added to the stage , or parent such as FlexEvent.ADDED or when the creation is complete ,  FlexEvent.CREATION_COMPLETE ?
       The second thing is your "button" variable.  It is declared outside of the loop in the "init" function.  Meaning , when that loop is done and even during execution , it will point to the last button created.  So all the buttons have listeners , meaning when one button fires off a ResizeEvent , it will remove the listener for whatever your variable "button" is pointing to.  This guarantees (well , maybe not) the behaviour that your last button will NOT have a listener , therefore it will not fire.
      By the way , you can set the label and the size of the button when you declare them. You don't have to subclass and use listeners.

  • How can I execute an external program from within a button's event handler?

    I am using Tomcat ApacheTomcat 6.0.16 with Netbeans 6.1 (with the latest JDK/J2EE)
    I need to execute external programs from an event handler for a button on a JSF page (the program is compiled, and extremely fast compared both to plain java and especially stored procedures written in SQL).
    I tried what I'd do in a standalone program (as shown in the appended code), but it didn't work. Instead I received text saying the program couldn't be found. This error message comes even if I try the Windows command "dir". I thought with 'dir' I'd at least get the contents of the current working directory. :-(
    I can probably get by with cgi on Apache's httpd server (or, I understand tomcat supports cgi, but I have yet to get that to work either), but whatever I do I need to be able to do it from within the button's event handler. And if I resort to cgi, I must be able to maintain session jumping from one server to the other and back.
    So, then, how can I do this?
    Thanks
    Ted
    NB: The programs that I need to run do NOT take input from the user. Rather, my code in the web application processes user selections from selection controls, and a couple field controls, sanitizes the inoputs and places clean, safe data in a MySQL database, and then the external program I need to run gets safe data from the database, does some heavy duty number crunching, and puts the output data into the database. They are well insulated from mischeif.
    NB: In the following array_function_test.pl was placed in the same folder as the web application's jsp pages, (and I'd tried WEB-INF - with the same result), and I DID see the file in the application's war file.
            try {
                java.lang.ProcessBuilder pn = new java.lang.ProcessBuilder("array_function_test.pl");
                //pn.directory(new java.io.File("K:\\work"));
                java.lang.Process pr = pn.start();
                java.io.BufferedInputStream bis = (java.io.BufferedInputStream)pr.getInputStream();
                String tmp = new String("");
                byte b[] = new byte[1000];
                int i = 0;
                while (i != -1) {
                    bis.read(b);
                    tmp += new String(b);
                getSelectionsDisplayTextArea().setText(getSelectionsDisplayTextArea().getText() + "\n\n" + tmp);
            } catch (java.io.IOException ex) {
                getSelectionsDisplayTextArea().setText(getSelectionsDisplayTextArea().getText() + "\n\n" + ex.getMessage());
            }

    Hi Fonsi!
    One way to execute an external program is to use the System Exec.vi. You find it in the functions pallet under Communication.
    /Thomas

  • How do I create an Event Handler for an Execute SQL Task in SSIS if its result set is empty

    So the precedence on my entire package executing is based on my first SELECT of my Table and an updatable column. If that SELECT results in an empty result set, how do I create an Event Handler to handle an empty result set?
    A Newbie to SSIS.
    I appreciate your review and am hopeful for a reply.
    PSULionRP

    Depends upon what you want to do in the eventhandler. this is what you can do
    Store the result set from the Select to a user variable.
    Pass this user variable to a Script task.
    In the Script task do whatever you want to do including failing the package this can be done by failing the script task, which in turns fails the package. something like
    Dts.TaskResult = Dts.Results.Failure
    Abhinav http://bishtabhinav.wordpress.com/

  • Javascript embedded in button pl/sql event handler not being executed

    Javascript calls not working from pl/sql button event handler. What am I missing? Are specific settings needed to execute javascript from pl/sql proceedures?
    Example: Want to toggle target='_blank' off and on in a button pl/sql event handler to open url call in new window & then reset when processing submit is done & the app returns to the form.
    portal form button's pl/sql submit handler:
    begin
    htp.p('<script language=JavaScript>') ;
    htp.p('this.form.target="_blank"') ;
    htp.p('</script>') ;
    PORTAL.wwa_app_module.set_target('http://www.oracle.com') ;
    htp.p('<script language=JavaScript>') ;
    htp.p('this.form.target="_blank"') ;
    htp.p('</script>') ;
    end ;
    Putting the following in the button's javascript on_click event handler works great:
    this.form.target='_blank'
    to force opening new window with a call in the button's submit pl/sql code via:
    PORTAL.wwa_app_module.set_target('http://www.oracle.com') ;
    but then the target='_blank' is left on when the submit is done & we return to the form.
    putting the above javascript as a function (called fcn_newpage) elsewhere (e.g., after form opens) & calling in the submit pl/sql with
    htp.p('fcn_newpage') ;
    also doesn't work.
    Metalink thought this was an application issue instead of a bug, so thought I'd see if anyone knows what's going wrong here. (Portal 9.0.4.1)

    thanks for your discussion of my post.
    Please clarify:
    "htp.p('fcn_newwindow') sends a string":
    What would you suggest the proper syntax for a function fcn_newwindow() call from a pl/sql javascript block that differs from
    htp.p('<script language="Javascript">') ;
    htp.p('fcn_newwindow');
    htp.p('</script>');
    or more simply
    htp.p('fcn_newwindow') ;
    More generally, what I'm trying to figure out is under what conditions javascript is executed, if ever, in the pl/sql of a button (either the submit or custom event handler, depending on the button).
    I've seen lots of posts asking how to do a simple htp.p('alert("THIS IS TROUBLE")') ; in a pl/sql event handler for a button on a form, but no description of how this can be done successfully.
    In addition to alerts, in my case, I'd like to call a javascript fcn from a pl/sql event handle that would pass a URL (e.g., http://www.oracle.com) where the javascript fcn executed
    window.open(URL). The API call to set_target(URL) in pl/sql has no ability to open in a new window, so calling that is inadequate to my needs and I must resort to javascript.
    Its clear in the PL/SQL of a button, you can effect form components since p_session..set_target & p_session.get_target set or get the contents of form components.
    So to see if javascript ever works, I tried to focus on something simple that only had to set what amounts to an enviromental variable when we returned to the form after a post. I chose to try to change the html value of TARGET from javascript in the PL/SQL button because it doesn't need to be implemented until we finish the post and return to the form.
    So I focused on a hack, setting this.form.TARGET='_blank' in the on_click event handler that forced every subsequent URL call or refresh of the form to be a new window. I then wanted to turn off opening new windows once I'd opened the URL call in a new window by setting TARGET='' in the portal form. I can achieve what I want by coding this.form.TARGET='' in the javascript (on_focus, on_change, or on_mousedown, ...) of every form component that might refresh the form. However, that is a ridiculous hack when a simple htp.p('<script>') ; htp.p('this.form.target=""') ; htp.p('</script>') ; at the end of the button's pl/sql event handle should do the same thing reliably if javascript ever works in the pl/sql event handler.
    If we didn't have access to form components through p_session calls, I'd assume it was a scope issue (what is available from the pl/sql event handler). But unless my syntax is just off, when, if ever, can javascript be used in a portal form's pl/sql event handler for a button?
    if I code a javascript funtion in the forms' pl/sql before displaying form:
    htp.p('<script language="JavaScript">') ;
    htp.p('function fcn_new_window(URL)') ;
    htp.p('window.open(URL)' ) ;
    htp.p('</script>') ;
    the function can be called from a button's on_click javascript event handler:
    fcn_new_window('http://www.oracle.com')
    but from the same button's pl/sql submit event handler this call doesn't work: htp.p('fcn_new_window("http://www.oracle.com")')
    So my questions remain: Is there other syntax I need, or does javascript ever work properly from the pl/sql of a form button's event handler? If it doesn't work, isn't this a bug that should be fixed by Oracle?
    I can probably figure out hacks to make things work the way I need, but executing javascript from pl/sql event handlers seems to be the expected way to affect portal html pages (forms, reports, ...) and it seems not to work as expected. I don't feel I should have to implement hacks for something as simple as calling a javascript function from pl/sql when almost every example I've found in metalink or the forums or Oracle Press's "portal bible" suggests using javascript from pl/sql via the utility htp.p() to effect web page components in portal.
    My TAR on the subject, while still open, returned the result basically: "We can reproduce your situation. Everything looks okay to us, but we can't explain how to use javascript where you want or point you to any documentation that would solve your problem or expain why it should not work the way you want it to. We don't feel its a technical issue. Why don't you post the problem on the portal applications forum."
    I'm hoping I'm just missing something fundamental and everything will work if I implement it a little differently. So if anyone sees my error, please let me know.
    by the way, not sure this is germain, but in reference to your comment:
    "redirections in pl/sql procedures give a peculiar result. in a pl/sql procedure, usually, portals give the last redirection statement and ignore anything else coming after it."
    if I try to raise an alert:
    htp.p('alert("you screwed up")');
    return;
    in a pl/sql event handler, it still doesn't raise the alert, even though its the last thing implemented in the event handler. But if I set the value of a text box using p_session..set_value_as_string() at the same spot, it correctly sets the text box value when I return to the form.

  • Setting Item level access rights on sharepoint list item in ItemAdding event handler

    Hi ,
    I am using sharepoint 2013. I am trying to set item level access rights when a list item is added using the following code snippet,
    public override void ItemAdding(SPItemEventProperties properties)
    base.ItemAdding(properties);
    ConfigureItemSecurity(properties);
    private void ConfigureItemSecurity(SPItemEventProperties properties)
    var item=properties.ListItem;
    SPSecurity.RunWithElevatedPrivileges(delegate()
    using (SPSite site = new SPSite(properties.SiteId))
    using (SPWeb oWeb = site.OpenWeb())
    item.ParentList.BreakRoleInheritance(true);
    oWeb.AllowUnsafeUpdates = true;
    var guestRole = oWeb.RoleDefinitions.GetByType(SPRoleType.Reader);
    var editRole = oWeb.RoleDefinitions.GetByType(SPRoleType.Editor);
    SPGroup HRGroup = oWeb.SiteGroups.Cast<SPGroup>().AsQueryable().FirstOrDefault(g => g.LoginName=="HR Team");
    SPRoleAssignment groupRoleAssignment = new SPRoleAssignment(HRGroup);
    groupRoleAssignment.RoleDefinitionBindings.Add(guestRole);
    SPUserCollection users = oWeb.Users;
    SPFieldUserValueCollection hm = (SPFieldUserValueCollection)item["HiringManager"];
    SPFieldUserValueCollection pm = (SPFieldUserValueCollection)item["ProjectManager"];
    SPFieldUserValueCollection pmChiefs = (SPFieldUserValueCollection)item["ProjectManagerChief"];
    item.BreakRoleInheritance(true);
    item.RoleAssignments.Add(groupRoleAssignment);
    foreach (SPFieldUserValue staffMember in hm)
    SetRightsOnItem(item, staffMember, editRole);
    foreach (SPFieldUserValue staffMember in pm)
    SetRightsOnItem(item, staffMember, guestRole);
    foreach (SPFieldUserValue staffMember in pmChiefs)
    SetRightsOnItem(item, staffMember, guestRole);
    item.Update();
    private void SetRightsOnItem(SPListItem item, SPFieldUserValue staffMember, SPRoleDefinition role)
    SPUser employeeUser = staffMember.User;
    var userRoleAssignment = new SPRoleAssignment(employeeUser);
    userRoleAssignment.RoleDefinitionBindings.Add(role);
    item.RoleAssignments.Add(userRoleAssignment);
    Nothing is happening though... Is the event handler the right place to do this?
    thank you

    Hi ,
    You can refer to the code working in my environment:
    using System;
    using System.Security.Permissions;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.Utilities;
    using Microsoft.SharePoint.Workflow;
    namespace ItemLevelSecurity.ItemSecurity
    /// <summary>
    /// List Item Events
    /// </summary>
    public class ItemSecurity : SPItemEventReceiver
    /// <summary>
    /// An item was added.
    /// </summary>
    public override void ItemAdded(SPItemEventProperties properties)
    SPSecurity.RunWithElevatedPrivileges(delegate()
    try
    using (SPSite oSPSite = new SPSite(properties.SiteId))
    using (SPWeb oSPWeb = oSPSite.OpenWeb(properties.RelativeWebUrl))
    //get the list item that was created
    SPListItem item = oSPWeb.Lists[properties.ListId].GetItemById(properties.ListItem.ID);
    //get the author user who created the item
    SPFieldUserValue valAuthor = new SPFieldUserValue(properties.Web, item["Created By"].ToString());
    SPUser oAuthor = valAuthor.User;
    //assign read permission to item author
    AssignPermissionsToItem(item,oAuthor,SPRoleType.Reader);
    //update the item
    item.Update();
    base.ItemAdded(properties);
    catch (Exception ex)
    properties.ErrorMessage = ex.Message; properties.Status = SPEventReceiverStatus.CancelWithError;
    properties.Cancel = true;
    public static void AssignPermissionsToItem(SPListItem item, SPPrincipal obj, SPRoleType roleType)
    if (!item.HasUniqueRoleAssignments)
    item.BreakRoleInheritance(false, true);
    SPRoleAssignment roleAssignment = new SPRoleAssignment(obj);
    SPRoleDefinition roleDefinition = item.Web.RoleDefinitions.GetByType(roleType);
    roleAssignment.RoleDefinitionBindings.Add(roleDefinition);
    item.RoleAssignments.Add(roleAssignment);
    Thanks,
    Eric
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected].
    Eric Tao
    TechNet Community Support

  • Custom event handler not executing

    Hello.
    I'm to set an event handler to execute after a user gets added a role. I have my plugin.zip file like this:
    -lib/(myjar).jar
    -plugin.xml
    Plugin.xml looks like this:
    <?xml version="1.0" encoding="UTF-8" ?>
    <oimplugins>
         <plugins pluginpoint="oracle.iam.platform.kernel.spi.EventHandler">
              <plugin pluginclass="com.uti.oim.events.SqlRoleHandler" version="1.0" name="SqlRoleHandler" />
         </plugins>
    </oimplugins>
    Placed it in the plugins directory in my dev environment.
    customhandler.xml looks like this:
    <?xml version='1.0' encoding='UTF-8'?>
    <eventhandlers>
         <action-handler class="com.uti.oim.events.SqlRoleHandler" stage="postprocess" sync="TRUE" entity-type="RoleUser" operation="CREATE" name="SqlRoleHandler" order="1000"/>
    </eventhandlers>
    What am I doing wrong? Thanks.

    I ran into an issue with event hanlders in 11g. This might apply to yours. I was unable to create both a preprocess and postprocess task on the same object. It always threw an error on the postprocess class that it can't be case as a pre process event handler. So the solution was removal of all preprocess and just go with postprocess and use the EntityManager class to make the updates to not trigger another update. We had to process post-create user tasks for bulk recon, and could not process it in pre, so our only option was to move it all to post.
    -Kevin

  • Item close event is triggering twice for Advanced Data Grid

    HI, I'm using AdvancedDataGrid for my project. My issue is when click on item close, the item close event is triggering twice. Why it is triggering twice? Thank you...

    Hi,
    Would you mind reposting your question over on the Flex forums?  You'll most likely have better luck over there.
    Thanks,
    Chris

  • Execute procedure in pl/sql button event handler

    i have a demo application which consists of text boxes
    eg : when i enter department no in first text box and click proc
    it should display dname and loc in the below text boxes.
    my proc is working fine in sql*plus but its showing errors in pl/sql button event handler.
    any ideas
    my proc is create or replace procedure proc1 (no number)
    as
    DNAME1 dept.dname%type;
    LOC1 dept.loc%type;
    begin
    select DNAME,LOC into DNAME1,LOC1 from scott.dept where deptno = no;
    DBMS_OUTPUT.PUT_LINE (DNAME1);
    DBMS_OUTPUT.PUT_LINE (LOC1);
         Exception When No_Data_Found then
    dbms_output.put_line('Entred name is not found');
    When Others then
    Null;
    End;
    /

    Hi,
    you have to use
    htp.p('<SCRIPT LANGUAGE="Javascript1.1">
    document.all("FORMNAME.DEFAULT.ATTRIBUTENAME.01").value="'||DNAME1||'";
    document.all("FORMNAME.DEFAULT.ATTRIBUTENAME.01").value="'||LOC1||'";
    </SCRIPT>
    instead of
    DBMS_OUTPUT.PUT_LINE (DNAME1);
    DBMS_OUTPUT.PUT_LINE (LOC1);
    where formname is your form name and attribute name is the field name on the page.

  • WPF UI running in seperate runspace - able to set/get controls via synchronized hash table, but referencing the control via the hash table from within an event handler causes both runspaces to hang.

    I am trying to build a proof of concept where a WPF form is hosted in a seperate runspace and updates are handled from the primary shell/runspace. I have had some success thanks to a great article by Boe Prox, but I am having an issue I wanted to open up
    to see if anyone had a suggestion.
    My goals are as follows:
    1.) Set control properties from the primary runspace (Completed)
    2.) Get control properties from the primary runspace (Completed)
    3.) Respond to WPF form events in the UI runspace from the primary runspace (Kind of broken).
    I have the ability to read/write values to the form, but I am having difficulty with events. Specifically, I can fire and handle events, but the minute I try to reference the $SyncHash from within the event it appears to cause a blocking condition hanging both
    runspaces. As a result, I am unable to update the form based on an event being fired by a control.
    In the example below, the form is loaded and the following steps occur:
    1.) Update-Combobox is called and it populates the combobox with a list of service names and selects the first item.
    2.) update-textbox is called and sets the Text property of the textbox.
    3.) The Text value of the textbox is read by the function read-textbox and output using write-host.
    4.) An event handle is registered for the SelectionChanged event for the combobox to call the update-textbox function used earlier.
    5.) If you change the selection on the combobox, the shell and UI hangs as soon as $SyncHash is referenced. I suspect this is causing some sort of blocking condition from multiple threads trying to access the synchronized nature of the hash table, but I am
    unsure as to why / how to work around it. If you comment out the line "$SyncHash.TXT_Output.Dispatcher.Invoke("Send",[action]{$SyncHash.TXT_Output.Text = $Value})" within update-textbox the event handler will execute/complete.
    $UI_JobScript =
    try{
    Function New-Form ([XML]$XAML_Form){
    $XML_Node_Reader=(New-Object System.Xml.XmlNodeReader $XAML_Form)
    [Windows.Markup.XamlReader]::Load($XML_Node_Reader)
    try{
    Add-Type –AssemblyName PresentationFramework
    Add-Type –AssemblyName PresentationCore
    Add-Type –AssemblyName WindowsBase
    catch{
    Throw "Unable to load the requisite Windows Presentation Foundation assemblies. Please verify that the .NET Framework 3.5 Service Pack 1 or later is installed on this system."
    $Form = New-Form -XAML_Form $SyncHash.XAML_Form
    $SyncHash.Form = $Form
    $SyncHash.CMB_Services = $SyncHash.Form.FindName("CMB_Services")
    $SyncHash.TXT_Output = $SyncHash.Form.FindName("TXT_Output")
    $SyncHash.Form.ShowDialog() | Out-Null
    $SyncHash.Error = $Error
    catch{
    write-host $_.Exception.Message
    #End UI_JobScript
    #Begin Main
    add-type -AssemblyName WindowsBase
    [XML]$XAML_Form = @"
    <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Window.Resources>
    <DataTemplate x:Key="DTMPL_Name">
    <TextBlock Text="{Binding Path=Name}" />
    </DataTemplate>
    </Window.Resources>
    <DockPanel LastChildFill="True">
    <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
    <Label Name="LBL_Services" Content="Services:" />
    <ComboBox Name="CMB_Services" ItemTemplate="{StaticResource DTMPL_Name}"/>
    </StackPanel>
    <TextBox Name="TXT_Output"/>
    </DockPanel>
    </Window>
    $SyncHash = [hashtable]::Synchronized(@{})
    $SyncHash.Add("XAML_Form",$XAML_Form)
    $SyncHash.Add("InitialScript", $InitialScript)
    $Normal = [System.Windows.Threading.DispatcherPriority]::Normal
    $UI_Runspace =[RunspaceFactory]::CreateRunspace()
    $UI_Runspace.ApartmentState = [System.Threading.ApartmentState]::STA
    $UI_Runspace.ThreadOptions = [System.Management.Automation.Runspaces.PSThreadOptions]::ReuseThread
    $UI_Runspace.Open()
    $UI_Runspace.SessionStateProxy.SetVariable("SyncHash",$SyncHash)
    $UI_Pipeline = [PowerShell]::Create()
    $UI_Pipeline.Runspace=$UI_Runspace
    $UI_Pipeline.AddScript($UI_JobScript) | out-Null
    $Job = $UI_Pipeline.BeginInvoke()
    $SyncHash.ServiceList = get-service | select name, status | Sort-Object -Property Name
    Function Update-Combobox{
    write-host "`nBegin Update-Combobox [$(get-date)]"
    $SyncHash.CMB_Services.Dispatcher.Invoke($Normal,[action]{$SyncHash.CMB_Services.ItemsSource = $SyncHash.ServiceList})
    $SyncHash.CMB_Services.Dispatcher.Invoke($Normal,[action]{$SyncHash.CMB_Services.SelectedIndex = 0})
    write-host "`End Update-Combobox [$(get-date)]"
    Function Update-Textbox([string]$Value){
    write-host "`nBegin Update-Textbox [$(get-date)]"
    $SyncHash.TXT_Output.Dispatcher.Invoke("Send",[action]{$SyncHash.TXT_Output.Text = $Value})
    write-host "End Update-Textbox [$(get-date)]"
    Function Read-Textbox(){
    write-host "`nBegin Read-Textbox [$(get-date)]"
    $SyncHash.TXT_Output.Dispatcher.Invoke($Normal,[action]{$Global:Return = $SyncHash.TXT_Output.Text})
    $Global:Return
    remove-variable -Name Return -scope Global
    write-host "End Read-Textbox [$(get-date)]"
    #Give the form some time to load in the other runspace
    $MaxWaitCycles = 5
    while (($SyncHash.Form.IsInitialized -eq $Null)-and ($MaxWaitCycles -gt 0)){
    Start-Sleep -Milliseconds 200
    $MaxWaitCycles--
    Update-ComboBox
    Update-Textbox -Value $("Initial Load: $(get-date)")
    Write-Host "Value Read From Textbox: $(Read-TextBox)"
    Register-ObjectEvent -InputObject $SyncHash.CMB_Services -EventName SelectionChanged -SourceIdentifier "CMB_Services.SelectionChanged" -action {Update-Textbox -Value $("From Selection Changed Event: $(get-date)")}

    Thanks again for the responses. This may not be possible, but I thought I would throw it out there. I appreciate your help in looking into this.
    To clarify the "Respond to control events in the main runspace"... I'm would like to have an event generated by a form object in the UI runspace (ex: combo box selectionchanged event) trigger a delegate within the main runspace and have that delegate in
    the main runspace update the form in the UI runspace.
    ex:
    1.) User changes selection on combo box generating form event
    2.) Event calls delegate (which I have gotten to work)
    3.) Delegate does some basic processing (works)
    4.) Delegate attempts to update form in UI runspace (hangs)
    As to the delegates / which runspace they are running in. I see the $synchash variable if I run get-var within a delegate, but I do not see the $Form variable so I am assuming that they are in the main runspace. Do you agree with that assumption?

  • Event Handling in OADialogPage

    Hi,
    I have a scenario for my project.
    where user should get a alert message with Ok(Proceed) and Cancel Buttons, when the budget for ticket is insufficient. After the alert, if user clicks on "Proceed", then it should navigate to confirmation page. If user clicks on Cancel, it should navigate to previous page.
    For this I have used OADialogPage and belows follow my code. But When click on "Proceed", its not going to Proceed event handling.
    Please help me out, its very important to finish this work as soon as possible.
      public void processFormRequest(OAPageContext pageContext,OAWebBean webBean)
       super.processFormRequest(pageContext,webBean);
        OAApplicationModule am=pageContext.getApplicationModule(webBean);
        SSHRParams localSSHRParams = new SSHRParams(am.getOADBTransaction());  
        String itemkey = localSSHRParams.getItemKey();
        String itemType=localSSHRParams.getItemType();
        CallableStatement cs,cs1,cs2;
        // String pItemKey,pItemType;
        pageContext.writeDiagnostics(this, "item key of the page"+itemkey+", ", 1);
        pageContext.writeDiagnostics(this, "item Type of the page"+itemType+", ", 1);
        if(pageContext.getParameter("HrSubmit")!=null)
         pageContext.writeDiagnostics(this,"Entered into SubmitButton Event",1);
         try
           pageContext.writeDiagnostics(this,"The Login person is not HR",1);
           cs2=am.getOADBTransaction().getJdbcConnection().prepareCall("{call xxnwc_sshr_budget_online_pkg.budget_control_check(?,?,?) }");
           cs2.setString(1,itemType);
           cs2.setString(2,itemkey);
           cs2.registerOutParameter(3,Types.VARCHAR);
           cs2.execute();
           String budgecheck=cs2.getString(3);
           pageContext.writeDiagnostics(this,"Program budget_control_check is completed  and the Budget check is: "+budgecheck +".",1);          
        if(budgecheck.equals("SUCCESS"))
         pageContext.writeDiagnostics(this,"Budget Check is success",1);
        else
           pageContext.writeDiagnostics(this,"Budget Check is failed",1);
           MessageToken token[]=null;
           OAException message=new OAException("PER","Budget amount is insufficient for the course",token);
           OADialogPage dp=new OADialogPage((byte)1,message,null,"","");
           dp.setOkButtonItemName("Proceed");
           dp.setOkButtonLabel("Proceed");
           dp.setOkButtonToPost(true);
           dp.setNoButtonItemName("Cancel");
           dp.setNoButtonLabel("Cancel");
           dp.setNoButtonToPost(true);
           pageContext.redirectToDialogPage(dp);
       }//Try close
       catch (SQLException e)
        pageContext.writeDiagnostics(this,"SQL Exception Raised: "+e+",",1);
          // TO
      }//Submit Event Close
      if(pageContext.getParameter("Proceed")!=null)
                         Integer app_id=pageContext.getResponsibilityApplicationId();
                         pageContext.writeDiagnostics(this,"The application ID is : "+app_id+".",1);
                         String tr_id=pageContext.getTransactionId();
                         pageContext.writeDiagnostics(this,"The transaction id is : "+tr_id+". ",1);
                         String ProceedUrl = "OA.jsp?page=/oracle/apps/per/selfservice/review/webui/ConfirmPG&_rc=HR_PERSON_SIT_TOP_SS&p_app_id=app_id&OAFunc=NWC_TRAINING_ACT_HR_SIT_SS&p_tr_id=tr_id&retainAM=Y&addBreadCrumb=N&p_oapc=pageContext";
                         pageContext.writeDiagnostics(this,"in Proceed Condition",1);
                         OADBTransaction tr=am.getOADBTransaction();
                         tr.commit();
                          pageContext.forwardImmediately(ProceedUrl,null,
                           OAWebBeanConstants.KEEP_MENU_CONTEXT,                            
                           null,                                                   
                           null,
                           true,                           
                           OAWebBeanConstants.ADD_BREAD_CRUMB_NO);
      else if(pageContext.getParameter("Cancel")!=null)
                         Integer app_id=pageContext.getResponsibilityApplicationId();
                         pageContext.writeDiagnostics(this,"The application ID is : "+app_id+".",1);
                         String tr_id=pageContext.getTransactionId();
                         pageContext.writeDiagnostics(this,"The transaction id is : "+tr_id+". ",1);
                         String CancelUrl = "OA.jsp?page=/oracle/apps/per/selfservice/review/webui/ConfirmPG&_rc=HR_PERSON_SIT_TOP_SS&p_app_id=app_id&OAFunc=NWC_TRAINING_ACT_HR_SIT_SS&p_tr_id=tr_id&retainAM=Y&addBreadCrumb=N&p_oapc=pageContext";
                         pageContext.writeDiagnostics(this,"in Cancel Condition",1);
                         OADBTransaction tr=am.getOADBTransaction();
                         tr.commit();
                          pageContext.forwardImmediately(CancelUrl,null,
                           OAWebBeanConstants.KEEP_MENU_CONTEXT,                            
                           null,                                                   
                           null,
                           true,                           
                           OAWebBeanConstants.ADD_BREAD_CRUMB_NO);
      }//ProcessFormRequest

    Hi,
    Just to inform, Its an Extension.
    I am not using Hashtable-FormParams,as the standard page buttons doesnt have any Parameters.

  • WPF Animation execute twice

    Hi All,
    I faced an issue regarding the Animation execute twice, please check the code:
    <Grid>
    <Grid.ColumnDefinitions>
    <ColumnDefinition Width="Auto"/>
    <ColumnDefinition Width="*"/>
    <ColumnDefinition Width="Auto"/>
    </Grid.ColumnDefinitions>
    <ListView x:Name="lstHandled" Grid.Column="0" Visibility="Visible">
    <ListViewItem>Jimmy</ListViewItem>
    <ListViewItem>Jimmy</ListViewItem>
    <ListViewItem>Jimmy</ListViewItem>
    <ListViewItem>Jimmy</ListViewItem>
    <ListViewItem>Jimmy</ListViewItem>
    <ListViewItem>Jimmy</ListViewItem>
    <ListViewItem>Jimmy</ListViewItem>
    <ListViewItem>Jimmy</ListViewItem>
    <ListView.Triggers>
    <EventTrigger RoutedEvent="ListView.MouseEnter">
    <BeginStoryboard>
    <Storyboard>
    <ThicknessAnimation
    Storyboard.TargetName="spAll"
    Storyboard.TargetProperty="(StackPanel.Margin)"
    From="-100,0,0,0" To="0,0,0,0"
    AutoReverse="False"
    Duration="0:0:1"/>
    </Storyboard>
    </BeginStoryboard>
    </EventTrigger>
    </ListView.Triggers>
    </ListView>
    <StackPanel x:Name="spAll" Grid.Column="0" Width="100" Margin="-100,0,0,0" Orientation="Horizontal">
    <ListView x:Name="Handled">
    <ListViewItem>Hello</ListViewItem>
    <ListViewItem>Hello</ListViewItem>
    <ListViewItem>Hello</ListViewItem>
    <ListViewItem>Hello</ListViewItem>
    <ListViewItem>Hello</ListViewItem>
    <ListViewItem>Hello</ListViewItem>
    <ListViewItem>Hello</ListViewItem>
    <ListViewItem>Hello</ListViewItem>
    </ListView>
    <ListView x:Name="UnHandled">
    <ListViewItem>World</ListViewItem>
    <ListViewItem>World</ListViewItem>
    <ListViewItem>World</ListViewItem>
    <ListViewItem>World</ListViewItem>
    <ListViewItem>World</ListViewItem>
    <ListViewItem>World</ListViewItem>
    <ListViewItem>World</ListViewItem>
    <ListViewItem>World</ListViewItem>
    </ListView>
    <StackPanel.Triggers>
    <EventTrigger RoutedEvent="StackPanel.MouseLeave">
    <BeginStoryboard>
    <Storyboard>
    <ThicknessAnimation
    Storyboard.TargetName="spAll"
    Storyboard.TargetProperty="(StackPanel.Margin)"
    From="0,0,0,0" To="-100,0,0,0"
    AutoReverse="False"
    Duration="0:0:1"/>
    </Storyboard>
    </BeginStoryboard>
    </EventTrigger>
    </StackPanel.Triggers>
    </StackPanel>
    </Grid>
    Here is the screenshot:
    When the mouse leave the "spAll" StackPanel. It fired the Mouse Enter event for the ListView. How to avoid this issue? 
    Thanks a lot!
    The future belongs to those who believe in the beauty of their dreams.

    You put your other two listviews in the same column of the grid.
    Since they're defined later, they will be above the first listview... and cause your problem.
    <Grid>
    <Grid.ColumnDefinitions>
    <ColumnDefinition Width="Auto"/>
    <ColumnDefinition Width="*"/>
    <ColumnDefinition Width="Auto"/>
    </Grid.ColumnDefinitions>
    <ListView x:Name="lstHandled" Grid.Column="0" Visibility="Visible">
    <ListViewItem>Jimmy</ListViewItem>
    <ListViewItem>Jimmy</ListViewItem>
    <ListViewItem>Jimmy</ListViewItem>
    <ListViewItem>Jimmy</ListViewItem>
    <ListViewItem>Jimmy</ListViewItem>
    <ListViewItem>Jimmy</ListViewItem>
    <ListViewItem>Jimmy</ListViewItem>
    <ListViewItem>Jimmy</ListViewItem>
    <ListView.Triggers>
    <EventTrigger RoutedEvent="ListView.MouseEnter">
    <BeginStoryboard>
    <Storyboard>
    <DoubleAnimation
    Storyboard.TargetName="spAll"
    Storyboard.TargetProperty="(StackPanel.Width)"
    From="0" To="120"
    AutoReverse="False"
    Duration="0:0:1"/>
    </Storyboard>
    </BeginStoryboard>
    </EventTrigger>
    <EventTrigger RoutedEvent="ListView.MouseLeave">
    <BeginStoryboard>
    <Storyboard>
    <DoubleAnimation
    Storyboard.TargetName="spAll"
    Storyboard.TargetProperty="(StackPanel.Width)"
    From="120" To="0"
    AutoReverse="False"
    Duration="0:0:1"/>
    </Storyboard>
    </BeginStoryboard>
    </EventTrigger>
    </ListView.Triggers>
    </ListView>
    <StackPanel x:Name="spAll" Grid.Column="1" Width="0" Orientation="Horizontal">
    <ListView x:Name="Handled">
    <ListViewItem>Hello</ListViewItem>
    <ListViewItem>Hello</ListViewItem>
    <ListViewItem>Hello</ListViewItem>
    <ListViewItem>Hello</ListViewItem>
    <ListViewItem>Hello</ListViewItem>
    <ListViewItem>Hello</ListViewItem>
    <ListViewItem>Hello</ListViewItem>
    <ListViewItem>Hello</ListViewItem>
    </ListView>
    <ListView x:Name="UnHandled" Grid.Column="2">
    <ListViewItem>World</ListViewItem>
    <ListViewItem>World</ListViewItem>
    <ListViewItem>World</ListViewItem>
    <ListViewItem>World</ListViewItem>
    <ListViewItem>World</ListViewItem>
    <ListViewItem>World</ListViewItem>
    <ListViewItem>World</ListViewItem>
    <ListViewItem>World</ListViewItem>
    </ListView>
    </StackPanel>
    </Grid>
    The above puts your listviews in different columns, although I'm not 100% sure that's what you wanted to happen.
    You would also have to animate the first listview if you want that to disappear.
    There's a potential problem there since as you do that your mouse will leave it.
    I guess you're probably just kind of playing around learning stuff here though.
     PS
    I based this on your first, now deleted, thread.
    Hope that helps.
    Technet articles: Uneventful MVVM;
    All my Technet Articles

  • Disable Sharepoint 2010 Event Handler

    I have two different event handler solutions in a list. One event handler runs on multiple lists if an Item is being Updated. Lets call that event handler (A). I have another event handler that runs on only one list. Lets call that event handler (B). Both
    the event handlers (A) and (B) runs on the list that I am talking about. When an item is being updated, I have some scenarios when I want to disable event handler (B) but not (A). Event Handler (A) should run as usual. How do I disable just one event Handler?
    I am using the code below to disable and enable the event handlers. This is disabling both the event handlers.
    EventFiring eventFiring = new EventFiring();
    eventFiring.DisableHandleEventFiring();
    ....some code
    eventFiring.EnableHandleEventFiring();

    Hi,
    According to your description, you may want to manage the execution of the two Event Receivers for a specific list.
    As a common practice, it is not recommended to control an Event Receiver from another Event Receiver, I would suggest you use the Event Receiver (A) only to capture the ItemUpdated event.
    Since you might have different logic in the two Event Receivers, a possible workaround I can provide is that you can execute the two different logic accordingly by checking the name of the list which the item event occurs in, usually, an if…else… block would
    do the trick.
    Best regards
    Dennis Guo
    TechNet Community Support

  • SBO2004: Event Handling problems

    Hello, all
    I have noticed a very peculiar thing about the way SBO handles events.
    I wrote a handler for the et_VALIDATE event on an EditText item (Sales Quotation->Customer) which does nothing but waits for two minutes. Then I performed the following experiment:
    Opened a sales quotation from in the Add mode, chose a Customer and added an item. Them I put the cursor into the Cusotmer field and pressed "Add". As a result, my event handler fired, so SBO was "frozen" for two minutes. But when the handler had completed nothing happened. The quotation wasn't added, although I didn't set BubbleEvent to false in the eventhandler.
    However, when I reduced the wait time to 30 seconds in the event handler everything started to work as it should: after completion of the eventhandler the quotation got added.
    Looks like if the handler of the preceding event (VALIDATE) executes for too long the following event (ITEM_PRESSED) may not fire at all...
    I this a correct behavior?
    Thanks in advance,
    Anton
    PS: I was testing in SBO2004

    Please update your system. Version 2004 is no longer supported.
    Hello, Vitor
    I know this, but I can't update soon. So I hope somebody can either confirm this problem or suggest a solution/workaround. But OK, I will check this in SBO2007.
    Anton

Maybe you are looking for

  • Replication of Business Partner from ISU to CRM

    Hello, I am creating the Business partner through 'BP' transaction and it is getting replicating to CRM, But when I am creating the Buiness Partner through 'Emigall' transaction it is not replicating to CRM. Also I added the many fields like u2018TIM

  • Rebate didn't go through

    I recently received a letter in the mail that said that I must resubmit my rebate with the UPC Bar Code and the Device ID. When I originally sent in my rebate I followed the verizon agents instructions to a T.

  • Proper Port Name Mini-DVI or Micro-DVI or Mini-DisplayPort

    Hello. I have got a new Macbook Pro but the connection for external monitors on it does not fit with my DVI connections for my old macbook pro. What connection do I need to connect to a DVI cable coming from my monitor? Is there a cable that works fo

  • Macbook pro wont display seconds in the clock

    i am using the digital clock for my comp and when i click "show day of week" it shows up and when i click "flash time separators" they start flashing....but when i click "display time with seconds" nothing happens...any ideas why it's not working?

  • Tweak loquendo voice pronunciations in Captivate 5?

    I have been experimenting with the Loquendo voices in Captivate 5. I noticed that the French voice pronounces the word "element" incorrectly. How can you tweak pronunciations for these Loquendo voices? I know how to do it for the Neospeech voices, wi