Skip to Content
0
Former Member
May 29, 2008 at 01:48 PM

Mimic key press ..

35 Views

Hi ,

I have an addon which displays a screen attached to a UDO .. On the screen I have button which loads another screen which i want to populate with some data from another UDO .. So i populate key and try to reproduce pressing "find" key .. My code in the first screen button handler is shown below ..


public virtual void OnAfterClick(ItemEvent pVal) {

            bool ActionSuccess = pVal.ActionSuccess;
            Form form = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            Item item = form.Items.Item("myButton");
            Button button = ((Button)(item.Specific));

            // ADD YOUR ACTION CODE HERE ...

            myUtility.LoadForm("testForm", ref counter);
            Form activeForm = B1Connections.theAppl.Forms.ActiveForm;
            activeForm.Freeze(true);

            // Populate the form  .. 
           
            activeForm.Mode = BoFormMode.fm_FIND_MODE;
            
            string work = ((EditText) form.Items.Item("DocEntry").Specific).Value;
            ((EditText)activeForm.Items.Item("DocEntry").Specific).Value = work;

            activeForm.EnableMenu("1281",true);
            B1Connections.theAppl.ActivateMenuItem("1281");
            activeForm.Items.Item("1").Click(BoCellClickType.ct_Regular);
            activeForm.EnableMenu("1281", false);
            .
            .
            activeForm.freeze(false); 

Problem is that the associated data ISN'T being displayed - only blanks in the bound database fields .. However the data base traversal keys are active (first,next,previous,last) and work so I can traverse the file and display data correctly .. Anyone any ideas ?