I have an app with a text field which is not user-enterable, and I’d like to overlay a transparent button so the user can click on the text field and be prompted for a new file.
I see this is possible with the transparent button attribute.
However even when I check the border checkbox, there is no border on the button. Is it easy to set up a rollover effect? I see a hook for mouse over in the UI Events, but not sure how I will suddenly make the transparent button shiny or whatever.
I’m doing this kind of UI because I have a very small window (deliberately) and don’t have room to crowd it with extra buttons.
Manipulate your button so that fits nicely around the text field. (If the button is blocking the text…select the button, and then choose “Send to Back” in the ‘Layout’ menu to make it fall behind the text). Also, make sure if your text field is dynamic text that you make the button surround the largest possible value for the field. In the ‘attributes’ pane, set the button’s “Bordered” property to unchecked… the button should be invisible… and set the “Icon Position” to ‘-’ (the straight line, top left…this makes the button text-only so you can change it’s size more effectively). In the button’s applescript pane, attach it to your script using both an ‘on mouse entered’ and an ‘on mouse exited’ event.
Set the code in your script to look like the code below, but with your reference to the button.
on mouse entered theObject event theEvent
set bordered of button "borderTest" of window "theWindow" to true
end mouse entered
on mouse exited theObject event theEvent
set bordered of button "borderTest" of window "theWindow" to false
end mouse exited
When you mouse over the text the button appears behind and with the border around the text field.
Interestingly enough, I can get it to work as you describe only if I turn the “transparent” attribute off. If transparent is on, then the border is never displayed.