How to add a shadow around a TextField like in Contacts ?

When you edit a contact in the Contacts application and select a field, the selected TextField is raised with a shadow. I tried different properties with the MBS plugin, but I get no result.

Christian has an example but it relies on the Paint event of the window. Unfortunately, I can’t use the Paint event, because my TextField is above a Rectangle control.

So, is there a way to add a shadow to a TextField ?

Not using the native textfield. You’re going to have to draw it in some manner. I would probably try placing the control on a canvas and seeing if I could “fake” the shadow in that way. don’t know. Never tried. You’re going to have to let go of your rectangle nevertheless.

There are two ways to get that effect :

  • Create a plain box window the size of your textfield (mine is width 136 height 22)
  • Place the text field on it
  • Show at the appropriate place

I believe that is how it is done in Contacts with a tiny window over the name

The other way is :

  • take a picture of the said window with shift-command-4 and press spacebar, then click on the window. You get a transparent png picture of the shadow
  • Put this picture in your project
  • Place a canvas underneath your text field with the shadow as backdrop