public XTextComponent InsertEditField(String defaultText, int _nPosX, int _nPosY, int _nWidth, int _nHeight, String echoChar, XTextListener _xTextListener, XFocusListener _xFocusListener, XKeyListener _xKeyListener, String sName = "")
        {
            XTextComponent xTextComponent = null;
            try
            {
                // create a unique name by means of an own implementation...
                if (String.IsNullOrWhiteSpace(sName)) sName = createUniqueName(MXDlgModelNameContainer, "EDIT");
                else sName = createUniqueName(MXDlgModelNameContainer, sName);
                

                // create a controlmodel at the multiservicefactory of the dialog model...
                Object oTFModel = MXMcf.createInstanceWithContext(OO.Services.AWT_CONTROL_EDIT_MODEL, MXContext);
                XMultiPropertySet xTFModelMPSet = (XMultiPropertySet)oTFModel;

                // Set the properties at the model - keep in mind to pass the property names in alphabetical order!
                xTFModelMPSet.setPropertyValues(
                        new String[] { "Height", "Name", "PositionX", "PositionY", "Text", "Width" },
                       Any.Get(new Object[] { _nHeight, sName, _nPosX, _nPosY, defaultText, _nWidth }));

                // The controlmodel is not really available until inserted to the Dialog container
                MXDlgModelNameContainer.insertByName(sName, Any.Get(oTFModel));

                if (!echoChar.Equals(String.Empty))
                {
                    XPropertySet xTFModelPSet = (XPropertySet)oTFModel;

                    // The following property may also be set with XMultiPropertySet but we
                    // use the XPropertySet interface merely for reasons of demonstration
                    xTFModelPSet.setPropertyValue("EchoChar", Any.Get((short)echoChar.ToCharArray(0, 1)[0]));
                }

                if (_xFocusListener != null || _xTextListener != null || _xKeyListener != null)
                {
                    XControl xTFControl = GetControlByName(sName);

                    // add a textlistener that is notified on each change of the controlvalue...
                    xTextComponent = (XTextComponent)xTFControl;
                    XWindow xTFWindow = (XWindow)xTFControl;
                    if (_xFocusListener != null) xTFWindow.addFocusListener(_xFocusListener);
                    if (_xTextListener != null) xTextComponent.addTextListener(_xTextListener);
                    if (_xKeyListener != null) xTFWindow.addKeyListener(_xKeyListener);
                }

            }
            catch (unoidl.com.sun.star.uno.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("uno.Exception:");
                System.Diagnostics.Debug.WriteLine(ex);
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("System.Exception:");
                System.Diagnostics.Debug.WriteLine(ex);
            }
            return xTextComponent;
        }
        public XTextComponent InsertEditField(String defaultText, int _nPosX, int _nPosY, int _nWidth, int _nHeight, String echoChar, XTextListener _xTextListener, XFocusListener _xFocusListener, XKeyListener _xKeyListener, String sName = "")
        {
            XTextComponent xTextComponent = null;

            try
            {
                // create a unique name by means of an own implementation...
                if (String.IsNullOrWhiteSpace(sName))
                {
                    sName = createUniqueName(MXDlgModelNameContainer, "EDIT");
                }
                else
                {
                    sName = createUniqueName(MXDlgModelNameContainer, sName);
                }


                // create a controlmodel at the multiservicefactory of the dialog model...
                Object            oTFModel      = MXMcf.createInstanceWithContext(OO.Services.AWT_CONTROL_EDIT_MODEL, MXContext);
                XMultiPropertySet xTFModelMPSet = (XMultiPropertySet)oTFModel;

                // Set the properties at the model - keep in mind to pass the property names in alphabetical order!
                xTFModelMPSet.setPropertyValues(
                    new String[] { "Height", "Name", "PositionX", "PositionY", "Text", "Width" },
                    Any.Get(new Object[] { _nHeight, sName, _nPosX, _nPosY, defaultText, _nWidth }));

                // The controlmodel is not really available until inserted to the Dialog container
                MXDlgModelNameContainer.insertByName(sName, Any.Get(oTFModel));

                if (!echoChar.Equals(String.Empty))
                {
                    XPropertySet xTFModelPSet = (XPropertySet)oTFModel;

                    // The following property may also be set with XMultiPropertySet but we
                    // use the XPropertySet interface merely for reasons of demonstration
                    xTFModelPSet.setPropertyValue("EchoChar", Any.Get((short)echoChar.ToCharArray(0, 1)[0]));
                }

                if (_xFocusListener != null || _xTextListener != null || _xKeyListener != null)
                {
                    XControl xTFControl = GetControlByName(sName);

                    // add a textlistener that is notified on each change of the controlvalue...
                    xTextComponent = (XTextComponent)xTFControl;
                    XWindow xTFWindow = (XWindow)xTFControl;
                    if (_xFocusListener != null)
                    {
                        xTFWindow.addFocusListener(_xFocusListener);
                    }
                    if (_xTextListener != null)
                    {
                        xTextComponent.addTextListener(_xTextListener);
                    }
                    if (_xKeyListener != null)
                    {
                        xTFWindow.addKeyListener(_xKeyListener);
                    }
                }
            }
            catch (unoidl.com.sun.star.uno.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("uno.Exception:");
                System.Diagnostics.Debug.WriteLine(ex);
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("System.Exception:");
                System.Diagnostics.Debug.WriteLine(ex);
            }
            return(xTextComponent);
        }
 public XTextComponent InsertEditField(String defaultText, int _nPosX, int _nPosY, int _nWidth, String echoChar, XTextListener _xTextListener, XFocusListener _xFocusListener, XKeyListener _xKeyListener, String sName = "") { return InsertEditField(defaultText, _nPosX, _nPosY, _nWidth, 12, echoChar, _xTextListener, _xFocusListener, _xKeyListener, sName); }
 public XTextComponent InsertEditField(String defaultText, int _nPosX, int _nPosY, int _nWidth, String echoChar, XTextListener _xTextListener, XFocusListener _xFocusListener, XKeyListener _xKeyListener, String sName = "")
 {
     return(InsertEditField(defaultText, _nPosX, _nPosY, _nWidth, 12, echoChar, _xTextListener, _xFocusListener, _xKeyListener, sName));
 }