4 Replies Latest reply: Sep 25, 2014 4:40 AM by Marcus Sommer RSS

    Variable true if activated object

    Андрей Шепель

      Good day!

      During several days i'm working at task of getting dynamically info about activated objects in QV 11.

      As audit logging files don't give us any info about opened object, my idea is:

      1. Create for each object one variable.

      2. Set to this variable value 1 if object is active

      3. Set the trigger for that variable OnChange Value: run macro (which will write info about active object to some txt file) if value in variable is changed (1 - active object, 0 - not active object)

       

      Have anyone ideas how to implement step 2 (Set to this variable value 1 if object is active) ?

       

      Maybe, someone has other way to solve this task (too much people try to solve similar task , if you know...)))

       

      Welcome

        • Re: Variable true if activated object
          Marcus Sommer

          Have a look on these snippet from APIGuide.qvw (is in your qv install-folder):

           

          rem ** minimize all active sheet objects on active sheet **

          set s=ActiveDocument.ActiveSheet

          objs=s.GetSheetObjects

          for i=lbound(objs) to ubound(objs)

              if objs(i).IsActive then objs(i).Minimize

          next

           

          Instead of minimize you could read the name, id, timestamp, user .... But I wouldn't create a variable for each object I would rather use one variable as logfile and append each new event as a new row. These variable could you write by closing the app or externally in a text-file. Then to scan each movement within the app is quite heavy but to write it immediately is more difficult - from performance point of view and if several users used the same app at the same time ...

           

          - Marcus

          • Re: Variable true if activated object
            Marcus Sommer

            All these things could you easily find within the APIGuide.qvw in the sheets "A... Members" and "A... Examples".

             

            User:

            set temp = ActiveDocument.GetApplication.GetProperties

            msgbox(temp.UserName)

             

            ObjectID:

            rem ** get unique object ID for first object on sheet Main **

            set s = ActiveDocument.Sheets("Main")

            set so = s.SheetObjects(0)

            id = so.GetObjectId

            msgbox("ID = " & id)

             

            Timestamp:

            = now()

             

            - Marcus