How to observe the events of closing on a library?

This morning, I wrote a new class to try and observe the events of closing for libraries. The idea is that I can know when my library is closed (by code or user) and perform actions.

The class inherits from Cobserve and implements AutoAttach, AutoDetach and update. Which is used by the functions is IID_LIBRARYSERVICE.

My update function looks like this:

If ((Protocol == IID_ILIBRARYSERVICE) & & (change == kLibraryCloseLibCmdBoss))
{
ICommand * ptrCommand = (ICommand *) ptrChangedBy;

If (ptrCommand! = nil)
{
const UIDList list = ptrCommand-> GetItemListReference();

If ((List.Length () > 0) & & (ptrCommand-> GetCommandState() == ICommand::kNotDone)))
{

Do something - go through the list, but only expect one.

Match UIDRef of library going to be closed.
}
}
}

In the resource file, I wrote an AddIn

AddIn
{
kLibraryBoss,
kInvalidClass,
{
IID_MYLIBRARYOBSERVER, kMyLibraryObserverImpl
}
}

The performance of the plug-in, I get no call in the code with the exception of CREATE_PMINTERFACE.

There are no samples in the SDK for libraries, so I'm not sure that I use the correct object or the boss in the add-in.

Anyone who has tried to do this? Thanks in advance for any help.

IK2ServiceRegistry::QueryDefaultServiceProvider (kLibraryServiceID) of use, it returns a kLibraryProviderBoss.

This pattern has as object to look at.

For example, you had AutoAttach during a boot service.

BTW, the itemlist of kLibraryCloseLibCmdBoss is empty. Take a look at her IID_ILIBRARYCMDDATA instead, it specifies the library as a source.

As long as you use a private IID or a boss for the observer, it doesn't really matter where you put it. Sometimes I would be component snap mine on the observed object (e.g. paper) even if for go-away notifications, I would choose something more long life. Often I put them on the same private boss who operates the boot service, or any other easily accessible boss - for example, see how many others live on kSessionBoss...

Dirk

Tags: InDesign

Similar Questions

  • How to get the event when we change our simcard in BB device

    Hi all

    Please, someone tell how to get the event or any listener method that can automatically called when we change our SIM card device.

    Thanks in advance,

    TEJ

    Hi Tej,

    I came across some post, which may be useful for you

    http://supportforums.BlackBerry.com/T5/Java-development/is-there-a-way-to-get-the-mobile-or-phone-nu...

    http://supportforums.BlackBerry.com/T5/Java-development/is-SIM-ID-really-exist/m-p/54407#M5954

  • I don't see the event live from the URL indicated. How to join the event online please?

    I don't see the event live from the URL indicated. How to join the event online please?

    At the time you posted this question, the STM sessions had not started yet. The event started at 9:00 PT.  Please let me know if you are still experiencing difficulties to connect.

    Note: all sessions will be available for consultation on request after the event is finished at 1:00 pm PT.

    See you soon,.

    LKR

  • How to check the event.target type in the "if" statement

    Hi, I have "roll-over" event listener and I wish that only works with music videos (without textfields etc.). I would write something like this:

    if(Event.Target == MovieClip) {do something}

    else {do something}

    This does not work properly.

    How to check the event.target type in the "if"?

    Thanks for any help.

    :

    If (getQualifiedClassName (Event.Target) == 'flash. display::MovieClip') {do something}

    else {do something}

    .

  • How to get the event when you click Add another button in a table.

    Hello
    How to recognize the event in processFormRequest click on the button Add another line of the footer of a table?

    Suppose if the ID is anotherRow (I mean ID of the button to add another line of the footer)

    If I give if (pageContext.getParameter ("anotherRow")! = null)... its not recognizing the event that is returning null only...

    I want to perform certain actions when the user clicks Add another line of footer. Please let me know the details of how identify when add another line is clicked...

    Thank you
    Srikanth

    Hello

    If you have only one table with add_row_button, and then copy the following code works perfectly

    If (tableBean.getName () .equals (pageContext.getParameter (SOURCE_PARAM)))
    (& ADD_ROWS_EVENT.equals (pageContext.getParameter (EVENT_PARAM)))
    {
    ...
    }

    tableBean is the Handle for your advanced table, hope, it will help you.

    Kind regards
    Out Sharma

  • iMovie 10 - how to merge the events from different sources?

    I libraries iMovie on 2 hard drives and in iMovie on two iMacs files both running iMovie 10.1.1

    How can I copy all my events on a single hard drive but leave the events and projects on both iMacs?

    The projects will move at the same time or how can I move them as well?

    Thanks for any help possible!

    You can copy events from one library to another of in iMovie.  See:

    http://help.Apple.com/iMovie/Mac/10.1/#/mov3fa25bae7

    For more details.

    Geoff.

  • Satellite L40 - 14G: how to change the function of "closing the lid.

    Hello

    If I close my laptop Toshiba Satellite L40 - 14G, PC went to the sleep mode.
    But I want that if I close the PC went to the sleep mode but it should function normally and show swtich off the coast.

    How can I do?

    Thanks for the reply!

    You have Vista?
    If Yes, then follow these steps:

    -Go to control panel
    -Energy options
    -To the left, click on the option called something like select what should happen when the lid is closed

    Greetings

  • How to make the event 'return key '.

    Hello

    How to create an event where operated button back?

    I have a few examples but never test running!

    CUMPS

    If you use the screen, then you can substitute keyChar and find the ESCAPE character.  Here is a code example:

            protected boolean keyChar(char character, int status, int time) {
                // regardless of where we are, Esc will exit
                switch (character) {
                    case Characters.ESCAPE:
                        close();
                        return true;
                    default:
                        return super.keyChar(character, status, time);
                }
            }
    
  • How to fix the very slow closing of windows 7 2 1/2 minutes to close

    When I shut down my computer, it takes at least 2 to 3 minutes to close, how can I fix that, please help.

    Hi jyperras,

    Thanks for posting in Microsoft Communities.  The problem description, I understand that the computer takes a long time to stop.  Correct me I misunderstood the question.

    1. What is the brand and model of the computer?

    2 have you made any changes to the computer before the show?

    Follow a few troubleshooting methods and check if that helps.

    Method 1: Disconnect non-essential external devices and then restart the computer. Check if the problem persists.

     

    Method 2: Open the troubleshooting of System Maintenance Utility

    http://Windows.Microsoft.com/en-us/Windows7/open-the-system-maintenance-Troubleshooter

    Method 3: Perform a clean boot to see if there is a conflict of third-party software like the clean boot helps eliminate software conflicts.
    HOW to solve a problem by performing a clean Windows Vista or Windows 7 boot http://support.microsoft.com/kb/929135

    If the game works well by disabling services not Microsoft, then you can follow the audit to determine which program is causing this problem.
    Note: After a repair, be sure to place the computer in normal mode.

    Also check the event viewer for event logs.

    What are the information contained in the logs of the event (Event Viewer)?
    http://Windows.Microsoft.com/en-us/Windows7/what-information-appears-in-event-logs-Event-Viewer

    For reference:
    Optimize Windows 7 for better performance
    http://Windows.Microsoft.com/en-us/Windows7/optimize-Windows-7-for-better-performance

    Note: The Microsoft Safety Scanner ends 10 days after being downloaded. To restart a scan with the latest definitions of anti-malware, download and run the Microsoft Safety Scanner again.
    The data files that are infected must be cleaned only by removing the file completely, which means that there is a risk of data loss.

    Please follow the steps and let us know if this helped.  If the problem persists, answer and we will be happy to help you.

  • How to make the event bus work?

    I don't think I understand how the event bus. I have two ActionScript classes. An instance of the class can send the DataRefreshInvocationEvent event and causes a refresh. An instance of the other class dispatches the event even, and nothing happens.

    Class that can successfully send the DataRefreshInvocationEvent, EventManager, resembles the ChassisEventManager class in the example of chassis-ui. The class that doesn't distribute the event successfully is a regular ActionScript class extending EventDispatcher. The two classes have the same metadata for events before the class definition.

    [Event (name = "{com.vmware.core.events.DataRefreshInvocationEvent.EVENT_ID}",

    Type = "com. VMware.Core.Events.DataRefreshInvocationEvent")]

    DispatchEvent calls are from the regular ActionScript class.

    This expedition at the start of the regular-ActionScript class does not cause a refresh:

    dispatchEvent (new DataRefreshInvocationEvent (DataRefreshInvocationEvent.EVENT_ID));

    but when the same line is changed to exit the EventManager local refresh occurs:

    EventManager.instance.dispatchEvent (new DataRefreshInvocationEvent (DataRefreshInvocationEvent.EVENT_ID));

    I would like to understand what what should do see his message distributed a class for the event bus.

    Thanks for the help,

    -Darrell

    Hi Darrell,

    This part is not well documented...  Most of the AS classes in your user interface must be seen mediators and they are automatically registered with the platform when declared with the DefaultMediator tag in the source view mxml, as:

    [DefaultMediator ("com.vmware.samples.chassisui.views.ChassisSummaryViewMediator")]

    To handle large events to applications with a singleton Manager class, you can use this API (see ChassisEventManager.as):

    import com.vmware.core.events.ObjectEvent;

    ...

    Instance of registers to the platform. Required to support [EventHandler].

    FlexGlobals.topLevelApplication.dispatchEvent (ObjectEvent.newAddition (this));

  • How to capture the event of selection of a table on the side line client (JavaScript)

    The example is:
    < af:table >
    < af:column >
    < af:outputText... >
    < af:clientListener... / >
    < /... >
    < /... >

    However, the text does not fill to the top of the cell. So, if I click on the on the empty area, the event handler is not called.
    I hope, even if I click on the empty area of the line, the event handler will be called.
    In fact, if I click on a row of a table at any location, including the empty area, the line becomes blue. How to capture this select event row on the client side?

    You can try file the client listener as a child under tag instead of the ?

    
    ...
    
    
    
    

    The above code should call a function in your js file called "handleTableDoubleClick", which, in turn, queued a ClientEvent that can be attached to a Backing Bean method. Something like:

    ...
        public void handleTableDoubleClick(ClientEvent ce) {
           //do something when the table is double clicked.
        }
    ...
    

    hope that helps

  • Get-VIEvent - how to export the event type?  error, warning, or info

    Hello

    I know that the Get-VIEvent command allows you to specify the type of events to get back... that is to say [-Types < EventCategory [>]

    but, I want to extract all the events and export them to a CSV file. I want one of the columns to be "EventCategory", which will be ERROR, WARNING, or INFO, but I can't seem to find it.  $_. GetType(). Name gets me the type of event, but not the category.  I know that I can have my script executed 3 times (each time specifying the - parameter Types) but I want to run only once.  Any ideas?

    Thank you!

    Jeff

    Hello, horningj-

    I worked on a few elements that should attract the event category.  The first selects a few properties, including a calculated property that gets the event category:

    ## works well if no events of type 'EventEx'## get the .Net View object of the EventManager (used for getting the event Category) $viewEventMgr = Get-View EventManager ## get some VIEvents, select a few properties, including a calculated property for EventCategory Get-VIEvent | Select FullFormattedMessage, CreatedTime, @{n="EventCategory"; e={$strThisEventType = $_.GetType().Name; ($viewEventMgr.Description.EventInfo | ?{$_.Key -eq $strThisEventType}).Category}}
    

    It becomes VIEvents (the last 100, because I did not specify the parameter - MaxSamples) and returns the properties of data.  The calculated "EventCategory" property uses the type of the VIEvent object to search for in the collection of items EventDescriptionEventDetail in ownership eventInfo found in .net object View for the EventManager.  He then grabs the 'Category' of the corresponding element of EventDescriptionEventDetail property.

    Works fine unless you have any VIEvents type "EventEx" - then, this 'research' in EventDescriptionEventDetail collection method fails, because there is more than one element of this type (there are 91 of them at the moment).

    This led me to the next bit.  It is similar to the previous method, but it handles EventEx events too:

    ## get the .Net View object of the EventManager (used for getting the event Category)$viewEventMgr = Get-View EventManager
    
    ## get some VIEvents (the last 100, as "-MaxSamples" is not specified) Get-VIEvent | %{    ## put the pipeline varible into another variable; get its type    $oThisEvent = $_; $strThisEventType = $_.GetType().Name    ## if this event is of type "EventEx"    if ($strThisEventType -eq "EventEx") {        $strEventTypeId = $oThisEvent.EventTypeId;        ## get the EventInfo item (of type EventDescriptionEventDetail) whose "FullFormat" property begins with the EventTypeId of the VIEvent at hand, and get its "Category" property        $strCategory = ($viewEventMgr.Description.EventInfo | ?{$strRegexPattern = "^$strEventTypeId\|.*"; $_.FullFormat -match $strRegexPattern}).Category    } ## end if     ## else, can just grab the EventInfo item whose "Key" is the same as this event's type    else {$strCategory = ($viewEventMgr.Description.EventInfo | ?{$_.Key -eq $strThisEventType}).Category}    ## add a NoteProperty "EventCategory" to this event    $oThisEvent | Add-Member -MemberType NoteProperty -Name EventCategory -Value $strCategory -PassThru} | Select FullFormattedMessage, CreatedTime, EventCategory
    

    It seems that the EventTypeId of the event returned by Get-VIEvent is included in the first part of the property FullFormat of elements EventDescriptionEventDetail with EventEx key, separate from the rest of the value by a vertical pipe.  Thus, the EventTypeId of the VIEvents can be used to make a match on EventEx of events .net EventManager View object types to get the event 'category' (info, warning, error, user).

    You can, of course, change the Select statements to choice/choose the pieces of information you want to export and then export to a file of data as you please.

    How does do for you?

    * The message has been edited by mattboren on April 5, 2011 - added line at the beginning of the second piece of code '$viewEventMgr = Get-view event Manager.  It was already in the first room and assumes that the user has run the two parts in the same session, but added for completeness.

  • How to get the event target?

    I recorded the event mask depending on:

    App.notifiers.Add ("Hd",.. mpfprojectdir\dev10\src\csharp\projectbase.file path);

    Now, how can he obtain the object that triggered the event?  [app.active document.activeLayer] give me only the layer ".  Of course, this does not work in a scenario where the user hides a layer that is not selected.

    I'd appreciate any help!

    Action handler has no direct access to objects in the object model. It has its own class and object. Sometimes, there may be a more direct access by name. If the event descriptor was the index of the layer or the ID you can use instead of the name.

    Sorry, when I threw together for you I only tested hidding layers that do not have the activeLayer. I don't think that the alert is empty is because the top layer was hidden. I think it's because the activeLayer was hidden so the actionReference is different.

    Try this (which seems to work for me with both)

    try {
        if (arguments.length >= 2) {
        var desc = arguments[0];
        var event = arguments[1];
        // make sure it's the hide event
        if (event == charIDToTypeID('Hd  ')) {
            // get the list of what was hidden
            var list = desc.getList(charIDToTypeID('null'));
            // get the actionReferences from the list
            var ref = list.getReference(0);
            var psClass = ref.getDesiredClass();
            // make sure it was a layer that was hidded
            if(psClass == charIDToTypeID('Lyr ')){
                // check to see what is in the reference
                var dataEnum = ref.getForm();
                // should either be an enum if activeLayer
                if(dataEnum == ReferenceFormType.ENUMERATED) {
                        alert(app.activeDocument.activeLayer.name);
                }else{// or the layer name
                    alert(ref.getName());
                }
            }
        }
      }
    } catch (e) {
      alert( "Error: " + e + ":" + e.line );
    }
    
  • How to avoid the event doubleclick on a datagrid scrollbars?

    Hello.

    I have a datagrid.

    I need a cliccking of doubleclick event on a data grid line.

    I activated the doubleclick event. It works fine, when the doubling of the user on a line, something happens! In my case, I open a modal window. Great!

    Now the problem:

    The problem arises when the user clicks in a short time on a data grid (horizontal or vertical) scroll bar. In this case, a double click event is dispatched.

    But his intenton is just to scroll the grid, not more.

    Please, note that the dobule click on a scroll bar is a well-known action that can be performed in all applications and operating systems.

    I neet the event 'double click' just on a grid lines of data and not on its scroll bars. Cliccking twice or more on the scroll bar, I just want to scroll the grid. How can they avoid to send an event?

    Thank you

    Pbesi

    can't you just check the target of the double click event? If the target is an itemRender then do your thing, if not then don't

  • How to get the events of the ItemRenderer

    Hello, I have a little problem. In my application, I use a list and build its elements with an itemRenderer. In this itemRenderer I have on each line, 1 label and 1 button. When I press the button I want to send this event in my main application... How can I create a communication between myApplication and itemRenderer?

    Thx for all

    Max

    
    
        
            
        
        
            
                
                    
    
                        
                            
                        
    
                    
                
            
        
    
    

    You can use the code above. Let me know if you have any questions.

Maybe you are looking for

  • iPad stuck on the apple logo

    IPad is stuck on the Apple logo and halfway along the slide to download was reset as the wifi would not connect

  • Computer laptop fan replaced but fan does not work

    Hello members of the Hp forum, a few months ago my laptop suddenly stopped fan to operate (the cause was probably lack of cleaning so the fans were clogged and eventually destroy its own engine) and I got the error at startup messages. So I had my fa

  • issue of Windows Update KB967715

    Hello Robert, I finally make this post into a new thread. So please, I need help, I am about to go to the hospital, my family needs of the computer for the study.  I can't get my new post into a new thread... Here's what I typed to m y new topic: Hel

  • Aspire 571-563 E5 cannot connect to MS acct after recovery Usb.

    I had to do a recovery for windows 8.1 USB about 4 months ago This time I couldn't select my account microsoft as always. He gave me a message, "we couldn't change your account because there is already an account on this PC with this e-mail address".

  • Receive error message whenever I do a right click on the taskbar

    Original title: Hello, I m using a HP DV5000 Laptop and I just came across this problem when I right click on the taskbar... you can help Description:A problem caused this program blocking interact with Windows. Signature of the problem:Problem event