try to set text in a textfield

Hi, even if i read lot of post, i can’t understand why it doesn’t work.
I’m trying to enter a text to a textfield.
first i define “dialogtext” to the returned from a dialog box.

after, i want this text to be in my text field

"mazone's setstringValue_(dialogtext)"

but i have always the error :

I don’t understant. I’m starting to be crazy. Please Help !

Hi,

the method names are case sensitive


mazone's setStringValue_(dialogtext)

thanks !

When i compile my code, the : setStringValue_ (with S in capital) always become a lowercase.

i don’t know why ?

Here is all the code of this very small app

script textfieldAppDelegate
	property parent : class "NSObject"
	
	-- IBoutlet
	property mazone : missing value
	
	
	-- IBaction
	
	on attributText_(sender)
		set dialogtext to text returned of (display dialog "your text " default answer "")
		mazone's setstringValue_(dialogtext)
	end attributText_
	
	on applicationWillFinishLaunching_(aNotification)
		-- Insert code here to initialize your application before any files are opened 
	end applicationWillFinishLaunching_
	
	on applicationShouldTerminate_(sender)
		-- Insert code here to do any housekeeping before your application quits 
		return my NSTerminateNow
	end applicationShouldTerminate_
	
end script

Once you’ve spelled it a certain way, xcode remembers it, and uses that version on a build. I suppose it’s a way of fixing unintentional uppercase/lowercase typos during a build. Typing |setStringValue_|(dialogtext) should do the trick. I thought there was some way of making xcode forget the misspelled version, but I never tried it, and I don’t remember it. Maybe someone will follow up with how to do that.

You can fix it by removing the offending letter, save your project then close it and close Xcode. When you restart your project, you can now put in the correct capitalization, and it will compile correctly.

Ric

Thanks a lot ! :smiley: :smiley: :smiley:

I delete all the line

I quit Xcode, delete the file “com.apple.Xcode.plist”

Launch again, type the new “mazone’s setStringValue_(dialogtext)”

and now it works.

{resolved}

BTW, you didn’t have to trash your Xcode pref file. This “memory” thing is not store in the prefs, but rather in the project file itself. This is why rdelmar’s solution works. :slight_smile:

Browser: Safari 531.22.7
Operating System: Mac OS X (10.6)

Actually, it’s not an Xcode thing – it’s an AppleScript thing.

That’s true, did it in AS editor too…