Use Dfclient.pkg
Use cTextEdit.pkg

Object retxt_dg is a dbModalPanel

    Property Boolean pbOk False

    Set Label to "Edit text"
    Set Location to 26 79
    Set Size to 160 291
    Set piMinSize to 82 206


    Object oBox is a Container3d
        Set Size to 137 285
        Set Location to 2 2
        Set peAnchors to anAll
        
        Object oText is a cTextEdit
            Set Size to 128 276
            Set Location to 2 2
            Set Color to clWhite
            Set TextColor to clBlack
            Set peAnchors to anAll
        End_Object  

    End_Object  

    Object oOk_bn is a Button
        Set Label to "&Ok"
        Set Location to 143 177
        Set peAnchors to anBottomRight

        Procedure Onclick
            Set pbOK to True
            Send Close_Panel
        End_procedure

    End_Object 

    Object oAnnuller_bn is a Button
        Set Label to "&Cancel"
        Set Location to 143 235
        Set peAnchors to anBottomRight


        Procedure OnClick
            Send Close_Panel
        End_procedure

    End_Object  


    On_Key Key_Alt+Key_O Send KeyAction to oOk_bn
    On_Key Key_Alt+Key_C Send KeyAction to oAnnuller_bn
    On_Key Key_F2 Send KeyAction to oOk_bn
    On_Key KCancel Send KeyAction to oAnnuller_bn

    
    Function EditText String ByRef sText Integer iMaxLength Returns Boolean
        Boolean bOk
        Address aText
        Set piMaxChars of oText to iMaxLength
        Move (AddressOf(sText)) to aText
        Set paValue of oText to aText
        Set pbOK to False
        Send Popup
        Get pbOK to bOk
        If bok Begin
            Get paValue of oText to aText
            Move aText to sText
        End
        Function_Return bOk
    End_Function

End_Object