Plex 2E

  • 1.  JAVA Dynamic combo box

    Posted Apr 13, 2013 11:22 AM
    Does anyone have the JAVA code required to dynamically load a comb box and the to retrieve the selected item?

    There was a post by Christopher but I cant make sense of it or get it to work.


  • 2.  RE: JAVA Dynamic combo box

    Posted Apr 14, 2013 01:29 AM


  • 3.  RE: JAVA Dynamic combo box

    Posted Apr 14, 2013 06:32 AM
    Thanks George, but doesnt work.

    I used this

    {
    ObRun.ObPanel.ObCtrlGui.ObComboGui myCombo;
    myCombo = (ObRun.ObPanel.ObCtrlGui.ObComboGui)ObUserAPI.getControlByName(this.getCaller(), new ObCharFld("*Current"), &(1:).toString());
    if (myCombo != null)

    { final String param0 = &(2:).toString();

    final String param1 = &(3:).toString();

    ((ObComboData)myCombo.getData()).addValuePair(param1, param0);

    ((ObComboData)myCombo.getData()).finishValues(param1, param0);

    }
    }


    I get the following error

    [javac] C:\Vulindlela7_MDL\Gen\Src\Vulindlela7PNL\AA6bF_ObFnc.java:377: error: cannot find symbol
    [javac] myCombo = (ObRun.ObPanel.ObCtrlGui.ObComboGui)ObUserAPI.getControlByName(this.getCaller(), new ObCharFld("*Current"), m_obvalfld_1.toString());


    Clearly I am not very good at JAVA, any suggestions?


  • 4.  RE: JAVA Dynamic combo box

    Posted Apr 15, 2013 03:47 AM
    dont now if this is any different but here goes

    First Source code- called to clear down combo and must be executed
    //Created 08October2003
    //Clear down a combox of all values
    // Param1: ControlName of panel control
    
    {
    
    ObRun.ObPanel.ObCtrlGui.ObComboGui myCombo;
    
    myCombo = (ObRun.ObPanel.ObCtrlGui.ObComboGui)ObUserAPI.getControlByName(this.getCaller(), new ObCharFld("*Current"), &(1:).toString());
    
    if (myCombo != null) myCombo.clear();
    }
    And the second source code to add values
    //Created 08October2003
    //Add a value description and hidden key to a combo control
    // Param1: ControlName of panel control
    // Param2: Hidden Key to be returned to Action Diagram 
    // Param3: Combo value to appear to the EndUser
    {
    
    ObRun.ObPanel.ObCtrlGui.ObComboGui myCombo;
    
    myCombo = (ObRun.ObPanel.ObCtrlGui.ObComboGui)ObUserAPI.getControlByName(this.getCaller(), new ObCharFld("*Current"), &(1:).toString());
    
            if (myCombo != null) {
    
    
    
    final String param0 = &(2:).toString();
    
    
    
    final String param1 = &(3:).toString();
    
    
    
    ((ObComboData)myCombo.getData()).addValuePair(param1, param0);
        
    
    ((ObComboData)myCombo.getData()).finishValues(param1, param0);
            }
    }
    this did work BUT CA java runtime changes and CA did not like me at the time for calling internal methods not offically exposed as they would change internal workings all the time which was and is their right,


  • 5.  RE: JAVA Dynamic combo box

    Posted Apr 16, 2013 01:18 AM
    Hi

    Yes this is exactly as I had it, but as you say CA change the runtime. The problem I hve is with the method "this.getCaller()". getCaller() is obviously not supported anymore, so what does it get replaced with?


  • 6.  RE: JAVA Dynamic combo box

    Posted Apr 16, 2013 03:55 AM
    dug up the actual decompiled (obrun.jar) source for this bit of source code, 2004... dont ask me why i keep this stuff...

    Well
     public final ObFunction getCaller()
        {
            return m_parentFunctionData;
        }
    still exisits in DecompiledAugust03_2004\ObRun\ObFunction\ObFunction.jad as it does today in DecompiledToday\ObRun\ObFunction\ObFunction.jad

    my java is to weak to go any further...my notes from my bfm java days about 'cannot find symbol' said make sure everthing is in the same package...


  • 7.  RE: JAVA Dynamic combo box

    Posted Apr 19, 2013 10:09 AM
    This does actually work, I had a blank source code object before thet addvalue source code and that was causing the error.

    Thanks for all the effort.


  • 8.  RE: JAVA Dynamic combo box

    Posted Mar 27, 2014 02:16 AM

    I want to set a default value to show in the combo box when it is loaded. I save the first value while reading all the records to be add.
    in Winc if you set the combo box to a value it shows it, but in Java it does not. I do a set and a a put but it does not show the value.

    I assume I need to also do it at the source code level then, what would the method be to do this based on the above code?



  • 9.  RE: JAVA Dynamic combo box
    Best Answer

    Posted Mar 27, 2014 02:40 AM

    Moment of stupidity...again...I was setting the description and not the value :-(