| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
set newTitle to (xVal + cVal)you are coercing two strings into a number, and then trying to set the title of theObject to a number, which gives unexpected results*. Simply coerce newTitle into a string as you set it:
set title of theObject to (newTitle as string)
Oops ... haven't noticed this before:_______________________________________________
when i do the display dialog the first time I click I get 3 values: 0,1,1
the second time I get ...,1,1 where ... is nothing ...
strange
Op 20-dec-03 om 06:21 heeft Joseph Weaks het volgende geschreven:Chris,
When you put a
display dialog cVal & return & xval & return & newTitle
before the set title line, are all the variables as you'd expect, even the second, third time around?
Cheers,
Joe Weaks
On Dec 19, 2003, at 9:43 PM, Chris Eneman wrote:I have a problem setting a buttons title more than once.
I figured it would be quite simple but I just can't seem to find a solution:
I have a text field where one can enter a numeric value.
I want to that value to be added to the value of the button, ie the title of the button, each time it is clicked
hence this code:
on clicked theObject
set cVal to contents of text field "c" of window "main"
set xVal to title of theObject
set newTitle to (xVal + cVal)
set title of theObject to newTitle
end clicked
This works fine, but it only works once ! Wahetever I seem to try, the title of the button seems to be sticked to the initial value, being 0.
If I change cVal, newTitle changes to (0+cVal). When I click again, it remains (0+cVal)
anyone ?
regards
chris
| References: | |
| >button title problem (From: Chris Eneman <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.