In my project I have a custom view but it is not in any kind of window, but it can still hold UI elements and such. There is a text filed inside my custom view but when I try and get the text from it I get an error that says
Heres the code:
set gt_input to contents of text field "gt_search" of view "view"
display dialog gt_input
Are you kidding me? You post at 8 in the morning, before many of us are even awake, and then come back and bump the post barely an hour later? Perhaps you could give us all a chance to replenish our caffeine levels and tend to our responsibilities before we sit down to save your world. After this show of blatantly selfish impatience, I wouldn’t help you regardless of how easy the solution was.
not 8 in the morning where i live jobu, sorry dude, it was 11:30 where im from, then i bumped 1 hour later, cud have waited longer for the bump i suppose, just anxious because i can barely start my program without knowing this…ive googled everything i cud find plus i searched everywhere on these forums. I can’t find any example AS Studio apps that use it, so excuse me for not being the guru you are, its just frustrating that I can barely start my new program because of this stupid roadblock
Nope, not in any kind of tell block, this is my whole program so far lol, as you can see I can’t really start anything until I can reference the custom view By the way the custom view is a subclass of NS View if that helps.
-- Halo 3 Menu Stats.applescript
-- Halo 3 Menu Stats
-- Created by Collin Henderson on 03/03/08.
-- Copyright 2008 __MyCompanyName__. All rights reserved.
on launched theObject
call method "showMenuIcon" of class "Menulet"
end launched
on idle theObject
--blah blah
end idle
on activated theObject
--blahblah
end activated
on awake from nib theObject
(*Add your script here.*)
end awake from nib
on action theObject
if the name of theObject = "gt_search" then
get_gamertag()
end if
end action
on get_gamertag()
set gt_input to contents of text field "gt_search" of view "main"
display dialog gt_input
end get_gamertag
maybe it’s a problem with the way the Ob-C gets the view? I don’t know Ob-C but is it copying the contents of your view as appose to just displaying it?
I had a fullscreen Ob-C script that made windows stretch to fit the screen but it just took the contents of the window and made a new one - this broke all as links
I’m in the same boat as you, I have no Obj-C knowledge, thats why I probably need Dominik, or jobu (who refused to help me now), and I havent seem Dom in a while
Does Bruce Phillips know any Obj-C? I’m really eager to get this app started!
Individual views do not lend themselves well to AS usage in this way. Views alone do not initialize as you would expect, and never call their awake from nib handler unless they are in a window. So, I would recommend making a window with all of your stuff in it, and make your view the window’s content view. Then, at launch-time you can get the content view of the window, save a reference to it in a persistent variable, and use that. After the following code executes, you can use ‘SuperDuperView’ anywhere in your code to access your view programmatically.
property SuperDuperView : null
on launched theObject --> Connected to your application object
set SuperDuperView to (content view of window "ExtraSpecialWindow")
end launched
ok, i don’t understand part of this because now the attached window that drops down has nothing inside it.
How do I copy everything in the window in to my custom view?