Page 1 of 1
Displaying numbers diagonally
Posted: Thu Jul 01, 2010 9:08 pm
by urbaud
I'm trying to figure out how to code a series of numbers (say, 1 to 20) to be displayed diagonally across the screen. The display would look like this:
Can anyone help?
Re: Displaying numbers diagonally
Posted: Thu Jul 01, 2010 9:50 pm
by bn
Hi Dan,
if you want to display the numbers in a field then you could try this:
1 field 1 button, button best placed in topleft corner, right underneath the field.
script of the button:
Code: Select all
on mouseUp
set the itemdelimiter to tab
put "" into field 1
repeat with i = 1 to 20
put i into item i of of line i of tCollector
end repeat
set the textsize of field 1 to 14 -- change fontsize
set the tabstops of field 1 to 20 -- change depending of your fontsize, also changes steepness
lock screen
put tCollector into field 1
-- this is just to make it look nice
set the vScrollbar of field 1 to false
put the topleft of field 1 into tTL
put the topleft of this stack into tStackTL
if the formattedWidth of field 1 + 18 > the width of this stack then set the width of this stack to the formattedWidth of field 1 + 150
if the formattedHeight of field 1 + 18 > the height of this stack then set the height of this stack to the formattedHeight of field 1 + 150
set the topleft of this stack to tStackTL
set the width of field 1 to the formattedwidth of field 1 + 18
set the height of field 1 to the formattedHeight of field 1
set the topleft of field 1 to tTL
end mouseUp
it all depends a little on the font you choose, you would have to experiment.
regards
Bernd
Re: Displaying numbers diagonally
Posted: Fri Jul 02, 2010 2:11 am
by Curry
Nice! Or insert spaces before each line, or use separate fields and place along the card. Lots of methods, just pick one.
Re: Displaying numbers diagonally
Posted: Fri Jul 02, 2010 11:05 am
by bn
Thanks Curry,
@ Dan
I tweaked the script a little. Use this one instead of the above.
Code: Select all
on mouseUp
set the itemdelimiter to tab
put "" into field 1
repeat with i = 1 to 20
put i into item i of of line i of tCollector
end repeat
set the textsize of field 1 to 14 -- change fontsize
set the tabstops of field 1 to 20 -- change depending of your fontsize, also changes steepness
lock screen
put tCollector into field 1
-- this is just to make it look nice
set the vScrollbar of field 1 to false
put the topleft of field 1 into tTL
put the topleft of this stack into tStackTL
set the width of field 1 to the formattedwidth of field 1 + 18
set the height of field 1 to the formattedHeight of field 1
set the topleft of field 1 to tTL
if the formattedWidth of field 1 + 18 + the left of field 1> the width of this stack then
set the width of this stack to the formattedWidth of field 1 + the left of field 1 + 50
end if
if the formattedHeight of field 1 + 30 + the top of field 1> the height of this stack then
set the height of this stack to the formattedHeight of field 1 + the top of field 1 + 50
end if
set the topleft of this stack to tStackTL
-- somehow I have to repeat this because otherwise on a second mouseClick it changes the width of the field again?
-- for example with 20 numbers
set the width of field 1 to the formattedWidth of field 1
set the topleft of field 1 to tTL
end mouseUp
regards
Bernd
Re: Displaying numbers diagonally
Posted: Mon Jul 05, 2010 10:16 pm
by urbaud
Hi Bernd,
Thanks so much for the reply-it works great. Now, all I have to do is sit down, review the code and figure out what you did to make it work. My wife and I just returned from a road trip through the southern interior of BC-great trip. Visited friends in Invermere, BC, stayed at Harrison Hot springs, and drove over 3000kms. You may have taken a road trip or two when you were in BC. Again, thanks for the help.
Dan