HELP for problem: I have 2 window in to my application and i need to load image in to image view" image1"locate in to second window “windowimage” , i click in to my button1 locate in to window “main” and image appear ok, after restart my application my “photo1” does not appear, the my application not remember my last command, the button status button1 appear ok the text field “text1” appear ok remember all command , only the image does not appear . i Post my code, someone HELP me . . .
This is my code :
property text1 : ""
property button1 : true
property image1 : ""
on awake from nib theObject
registerDefaultss()
try
readDefaultss()
showDefaultss()
end try
show window "main"
end awake from nib
on registerDefaultss()
tell user defaults
make new default entry at end of default entries with properties {name:"text1", contents:text1}
make new default entry at end of default entries with properties {name:"button1", contents:button1}
make new default entry at end of default entries with properties {name:"image1", contents:image1}
register
end tell
end registerDefaultss
on readDefaultss()
tell user defaults
set text1 to contents of default entry "text1"
set button1 to contents of default entry "button1"
set image1 to contents of default entry "image1"
end tell
end readDefaultss
on showDefaultss()
set contents of text field "text1" of window "main" to text1
set state of button "button1" of window "main" to button1
set image of image view "image1" of window "windowimage" to image1
end showDefaultss
on will quit theObject
getDefaultss()
writeDefaultss()
end will quit
on getDefaultss()
set text1 to contents of text field "text1" of window "main"
set button1 to state of button "button1" of window "main"
set image1 to image of image view "image1" of window "windowimage"
end getDefaultss
on writeDefaultss()
tell user defaults
set contents of default entry "text1" to text1
set contents of default entry "button1" to button1
set contents of default entry "image1" to image1
end tell
end writeDefaultss
on clicked theObject
if name of theObject is "button1" then
if state of theObject = 1 then
set contents of text field "text1" of window "main" to "showimage1" as text
set image of image view "image1" of window "windowimage" to load image "photo1"
else
set contents of text field "text1" of window "main" to "showimage2" as text
set image of image view "image1" of window "windowimage" to load image "photo2"
end if
end if
end clicked
Model: G5 DP 2700
AppleScript: 2.1
Browser: Safari 412.2.2
Operating System: Mac OS X (10.4)