Padding on button icon?
Posted: Tue Oct 15, 2013 10:42 pm
I am using the following code to generate a game board for a project. The board consists of a grid of buttons, the number of which is specified in field "field" (just temporary name, obviously).
The problem is that while the buttons are aligned perfectly, there is a space of about 3 pixels at the bottom of each button. If you click on the button, you can see that the icon is not taking up the entirety of the rect. This also seems to be the case when creating a new button. Other than using a custom icon, is there any way to change this behavior? I can't find any property that obviously corresponds to this behavior.
Code: Select all
on openCard
set the height of the templateButton to 30
set the width of the templateButton to 30
set the borderWidth of templateButton to 0
set the shadowoffset of templatebutton to 0
create group
end openCard
command makeBoard
put fld "field" into rowCount
put fld "field" into colCount
add 30 to locStartX
put 30 into locStartY
lock screen
repeat with x =1 to rowCount
repeat with y =1 to colCount
if locStartX is (30 * colCount + 30) then
put 30 into locStartX
add 30 to locStartY
end if
create button in first group
put it into newButtonID
put the long id of newButtonID into boardArray[x][y]
set the loc of newButtonID to locSTartx,locstarty
add 30 to locStartX
end repeat
end repeat
unlock screen
end makeBoard