Computer Science Canada Simple question about fonts |
Author: | nmr123321 [ Tue Jan 24, 2006 9:25 pm ] | ||
Post subject: | Simple question about fonts | ||
Is it possible to replace the size in a Font.New statement with a variable? any help will be appreciated |
Author: | Delos [ Tue Jan 24, 2006 9:29 pm ] | ||||
Post subject: | |||||
Sure it is. In this case, you've considered 'fontSize' as a string and not a variable. - "fontSize" vs. fontSize You'll have to catenate the value of 'fontSize' to the rest of the string. So, for instance:
See the difference? - type-casts Right now, you have fontSize as an int. To catenate, you have to have all types the same. You could consider redeclaring fontSize as a string instead, or you could just type-cast it. E.g.
See the difference? strint() and intstr() are useful, very (simple, acronymical names, too). Post up your code when you're done so we can see how well you fared. |
Author: | nmr123321 [ Tue Jan 24, 2006 9:49 pm ] | ||
Post subject: | |||
never seen this before, thanks .But do i put this instr(fontSize)+' outside the font statement. I am getting this error Bad font size'instr(fontSize)+' in font selection string
[/code] |
Author: | Clayton [ Wed Jan 25, 2006 8:22 am ] |
Post subject: | |
you dont put the + after your intstr(fontSize), you put that before instr(fontSize), then close the brackets. see if thats wat your prob is |
Author: | Clayton [ Wed Jan 25, 2006 8:23 am ] |
Post subject: | |
also close the quotes befor your variable otherwise turing wont recognize fontSize as a variable |