Plex 2E

 View Only
Expand all | Collapse all

ObPanelAPI::GetCurrentLogicalEvent(NULL); Analogous Needed for .Net Plex Generator

  • 1.  ObPanelAPI::GetCurrentLogicalEvent(NULL); Analogous Needed for .Net Plex Generator

    Posted Nov 21, 2019 03:27 AM
    Edited by NICOLAS MAVROEIDIS Nov 21, 2019 03:31 AM
    Hello All,

    At the CA Plex WinC Generator we had been given the following API:
    &(1:)=ObPanelAPI::GetCurrentLogicalEvent(NULL);
    in order to be able to retrieve the Current Logical Event Name.

    This was used by us in our templates in order to implement Event Level Security,
    that is in the Events Handler we had an Event  statement block into which we
    called the above API and retrieved the Current Logical Event Name in order to
    check it with the current user in our Security Database using our version of
    Security Check function.

    So, we need to be able to do the same in the .Net CA Plex
    generator environment.
    Is there already an analogous API available ?
    If not we need something like the following:

    namespace ObWPF.ObWPFCtrl
    {
    public class ObPanel : Window, IObUIMain, IObUICtrl, IObContextMenuOwner, IObDragAndDropControlWPF
    {   /* ...other definitions...*/
        public int CurrentAction { get; set; }
        /* ...other definitions...*/
        public void RegisterLogicalEvent(int id, string name);
        /* ...other definitions...*/
        public string GetLogicalEvent(int id); /* <== ***This is what we need*** */
        public string GetCurrentLogicalEvent(); /* <== ***OR This is what we need*** */
        /* ...other definitions...*/
    }
    }

    That is, to be able to Get the Logical Event Name that is Registered with the specific id,
    or to Get the Current Logical Event based on the CurrentAction.
    So, I can do such a call:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    sLogicalEventName = GetLogicalEvent(CurrentAction);   /* GetLogicalEvent From Action */
    /* OR */
    sLogicalEventName = GetCurrentLogicalEvent();
    - - - - - - - - - - - - - - - - - - - - - - -

    Kind Regards,
    Nicolas Mavroeidis

    ------------------------------
    Senior Software Engineer
    BASIS SA
    ------------------------------


  • 2.  RE: ObPanelAPI::GetCurrentLogicalEvent(NULL); Analogous Needed for .Net Plex Generator
    Best Answer

    Posted Dec 11, 2019 02:52 AM
    Edited by NICOLAS MAVROEIDIS Dec 11, 2019 03:28 AM
      |   view attached
    Hello All,

    Finally, after some more trial and error, I found how to achieve the above in the .NET CA Plex Generator.
    the ObWPF.ObWPFCtrl.ObPanel class, has the public property:
    public Hashtable ObActionCodes { get; }
    So, if we call the following C# source code API in a Plex C# function:
    {
    String sResult = "";
    foreach( DictionaryEntry de in panel.ObActionCodes )
    { sResult += (de.Key).ToString() + "\t-\t" +
    de.Value + "\n";
    }
    sResult += "CurrentAction:\nKey\t-\tValue\n" +
    CurrentAction.ToString() + "\t-\t" +
    panel.ObActionCodes[CurrentAction] + "\n";
    MessageBox.Show("ObActionCodes:\nKey\t-\tValue\n" + sResult);
    }
    we get the list of [Key,Value] pairs with the Action(Event) number and the Action(Event) name.
    Given the fact that the 'Current Event' number is the CurrentAction, we get the Current Event name
    with the following C# source code: 
    { &(1:).Value = (String)panel.ObActionCodes[CurrentAction]; }


    Kind Regards,
    Nicolas Mavroeidis

    ------------------------------
    Senior Software Engineer
    BASIS SA
    ------------------------------