Saturday, December 16, 2017

#1 2009-09-24 06:14:40 pm

Richard
Member
From:: Herefordshire, UK
Registered: 2009-09-09
Posts: 529
Website

Radio Buttons

OK so Craig makes it clear that with radio buttons you have to link the whole thing, not just one of the buttons.

My script:

Applescript:

script Dialog_MakerAppDelegate
   
   property parent : class "NSObject"
   
   property valwintext : missing value
   property valwinent : missing value
   property valwindef : missing value
   
   on subgo_(sender)
       
       set valtext to (valwintext's |string|() as string)
       
       if (valwinent's intValue()) is 1 then
           set valent to " default answer \""
       else
           set valent to ""
       end if
       
       tell application "TextEdit"
           activate
           tell application "System Events"
               keystroke "display dialog \"" & valtext & "\"" & valent --& valentdef & valentsec & valbut & valbutdef & valbutcal & valtit & valicon & valtmout
           end tell
       end tell
   end subgo_
   
   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 true
   end applicationShouldTerminate_
   
end script

So if valwinent is linked to the whole radio group using intValue it always returns 1 (and actions) if using stringValue it always returns 0 (there are many more combos with 'as string' and things) but if I link valwinent to either one of the radio button on their own it works fine. I get this hunch I might be using the wrong method, oh well I'd like an answer but no rush, I can use my way for now. smile

Edit:

What the! Now my way isn't working whats going on?

Edit:

Got my way working again with intValue.

Last edited by Richard (2009-09-24 06:44:29 pm)


Filed under: System, TextEdit

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)