How to set padding in text field

  1. 4 months ago

    i want to set padding from left side in text box.

    i am not getting the way to do it, Can any one tell me how to do this ?

  2. Emile S

    Jul 31 Europe (France, Strasbourg)
    Edited 4 months ago

    padding ?
    A margin inside a TextEdit Control ?
    If so, not built in AFAIK.

    Edit:
    Using rtf allows you to do that, but you have to open/save as rtf (not tested).

    I tested an rtf text created with margin in an application and Copy / Paste it in a TextArea.

    More Edits:
    I checked in more deep (inside TextArea1.StyledText.RTFData), and Xojo do not store the RTF code for the margins (after to color tbl block and before the text start (this code for example: \paperw11900\paperh16840\margl1440\margr1440\vieww15840\viewh19200\viewkind1).

  3. Jason K

    Jul 31 Pre-Release Testers

    @Emile S padding ?
    A margin inside a TextEdit Control ?
    If so, not built in AFAIK.

    Edit:
    Using rtf allows you to do that, but you have to open/save as rtf (not tested).

    I tested an rtf text created with margin in an application and Copy / Paste it in a TextArea.

    More Edits:
    I checked in more deep (inside TextArea1.StyledText.RTFData), and Xojo do not store the RTF code for the margins (after to color tbl block and before the text start (this code for example: \paperw11900\paperh16840\margl1440\margr1440\vieww15840\viewh19200\viewkind1).

    This doesn’t apply to iOS.

    @chetana n i want to set padding from left side in text box.

    i am not getting the way to do it, Can any one tell me how to do this ?

    You need to set the textAlignment property with a declare. It might be in iOSDesignExtensions, or you’ll need to write it yourself.

  4. Emile S

    Jul 31 Europe (France, Strasbourg)

    Sorry, I do not saw this question was for iOS.

  5. Dave S

    Jul 31 San Diego, California USA
    Edited 4 months ago

    @Jason K You need to set the textAlignment property with a declare

    That is for LEFT/RIGHT or CENTER... it does not control the TextField MARGIN/Padding

    I do not know how to do it in "Xojo for iOS", but here is how to do it in SWIFT, and perhaps some can translate

    let paddingView = UIView(frame: CGRect(x:0,y: 0, width:15,height: self.myTextField.frame.height))
    myTextField.leftView = paddingView
    myTextField.leftViewMode = UITextFieldViewMode.Always

    same thing can be done for the RIGHT as well

  6. Jeremie L

    Aug 1 Pre-Release Testers, Xojo Pro, XDC Speakers Europe (France) - getpackr.io

    iOSDesignExtensions has TextField.SetTextIndentXC function for this

    https://github.com/jkleroy/iOSDesignExtensions

or Sign Up to reply!