Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Place FormItemIcon in front/left of field, or inside-left

    I have the following code. I would like to place the FormItemIcons for the user ID and password fields, in front/left of the fields, or make them appear inside, on the left side of the field. As of now, they appear at the end/right of the fields, outside-right. See attached image.
    Please advise. Thank you!

    Code:
                // form creation
                userLoginForm = new DynamicForm();
                userLoginForm.setIsGroup(false);
                userLoginForm.setNumCols(1);
                userLoginForm.setCellPadding(10);
                userLoginForm.setAutoFocus(true);
                userLoginForm.setWrapItemTitles(false);
                userLoginForm.setWidth100();
                userLoginForm.setHeight100();
                // userLoginForm.setBackgroundColor(GlobalFieldMapping.HEAD_FOOT_BACKGROUND);
    
                // user id text item
                usernameTextItem = new TextItem("userId");
                usernameTextItem.setShowTitle(false);
                usernameTextItem.setWidth(300);
                usernameTextItem.setHeight(24);
                usernameTextItem.setRequired(true);
                usernameTextItem.setHintStyle("hintStyle");
                usernameTextItem.setHint("User ID");
                usernameTextItem.setShowHintInField(true);
                usernameTextItem.setAlign(Alignment.CENTER);
                FormItemIcon personIcon = new FormItemIcon();
                personIcon.setSrc(PERSON_ICON);
                usernameTextItem.setIcons(personIcon);
    
                // password text item
                passwordItem = new PasswordItem("password");
                passwordItem.setShowTitle(false);
                passwordItem.setWidth(300);
                passwordItem.setHeight(24);
                passwordItem.setRequired(true);
                passwordItem.setHintStyle("hintStyle");
                passwordItem.setHint("Password");
                passwordItem.setShowHintInField(true);
                passwordItem.setAlign(Alignment.CENTER);
                FormItemIcon passwordIcon = new FormItemIcon();
                passwordIcon.setSrc(PASSWORD_ICON);
                passwordItem.setIcons(passwordIcon);
    
                // set fields for form
                userLoginForm.setFields(usernameTextItem, passwordItem);
    Click image for larger version

Name:	LoginFields.JPG
Views:	21
Size:	2.8 KB
ID:	266655

    #2
    See FormItemIcon.inline and inlineIconAlign.

    Comment


      #3
      Thank you! That did it.

      Code:
      // user id text item
                  usernameTextItem = new TextItem("userId");
                  usernameTextItem.setShowTitle(false);
                  usernameTextItem.setWidth(300);
                  usernameTextItem.setHeight(24);
                  usernameTextItem.setRequired(true);
                  usernameTextItem.setHintStyle("hintStyle");
                  usernameTextItem.setHint("User ID");
                  usernameTextItem.setShowHintInField(true);
                  usernameTextItem.setAlign(Alignment.CENTER);
                  usernameTextItem.setIconHeight(22);
                  usernameTextItem.setIconWidth(22);
                  usernameTextItem.setIconHSpace(0);
                  FormItemIcon personIcon = new FormItemIcon();
                  personIcon.setSrc(GlobalFieldMapping.PERSON_ICON);
                  personIcon.setBaseStyle("loginIcon");
                  personIcon.setInline(true);
                  personIcon.setInlineIconAlign(Alignment.LEFT);
                  usernameTextItem.setIcons(personIcon);
      
                  // password text item
                  passwordItem = new PasswordItem("password");
                  passwordItem.setShowTitle(false);
                  passwordItem.setWidth(300);
                  passwordItem.setHeight(24);
                  passwordItem.setRequired(true);
                  passwordItem.setHintStyle("hintStyle");
                  passwordItem.setHint("Password");
                  passwordItem.setShowHintInField(true);
                  passwordItem.setAlign(Alignment.CENTER);
                  passwordItem.setIconHeight(22);
                  passwordItem.setIconWidth(22);
                  passwordItem.setIconHSpace(0);
                  FormItemIcon passwordIcon = new FormItemIcon();
                  passwordIcon.setSrc(GlobalFieldMapping.PASSWORD_ICON);
                  passwordIcon.setBaseStyle("loginIcon");
                  passwordIcon.setInline(true);
                  passwordIcon.setInlineIconAlign(Alignment.LEFT);
                  passwordItem.setIcons(passwordIcon);

      Comment

      Working...
      X