Sunday, September 20, 2015

Creating a password field with Livecode

You may have come to the point where you required a password field and thought: How on earth can I do that with a normal text field in Livecode.

Well, it's actually really easy.

Step 1: Import an image

You can check here how to import an image into Livecode. Most likely you want to download a black dot as image.

Step 2: Add code to the text field

Once you've imported the image you can see the id of the image by using the property inspector. Copy the code snippet from below and replace the image id with the id of your image.

on textChanged
  local tImageId
  
  -- the id of an image that you've imported (you need to change this)
  put 2764 into tImageId

  repeat with x = 1 to the number of chars of me
     set the imageSource of char x of me to tImageId
  end repeat
end textChanged

That's it! So now when you type something in to the text field, you'll see the image instead of the character.

1 comment: