Monday, December 11, 2017

#1 2009-10-10 05:20:11 am

Pandakopanda
Member
Registered: 2009-10-04
Posts: 4

Why do you need to explicitly cast NSInteger?

This doesn't work as expected:

Applescript:


       if aCheckbox's state is 1 then
           display alert "checked"
       else
           display alert "not checked"
       end if

But this does:

Applescript:


       if aCheckbox's state as integer is 1 then
           display alert "checked"
       else
           display alert "not checked"
       end if

Why the need to cast NSInteger?

And on a related note, what is the correct way to use the NSCellStateValue enum instead of hardcoded values?

Offline

 

#2 2009-10-10 05:59:45 am

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 5197

Re: Why do you need to explicitly cast NSInteger?

Pandakopanda wrote:

Why the need to cast NSInteger?


All results are returned as some kind of pointer class; you have to coerce them always.

And on a related note, what is the correct way to use the NSCellStateValue enum instead of hardcoded values?


I haven't had any luck with enums; I suspect they're not working at this stage. The fact that NSTerminateNow doesn't work in the default template probably supports this theory.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/

Offline

 

#3 2009-10-11 10:27:58 am

Pandakopanda
Member
Registered: 2009-10-04
Posts: 4

Re: Why do you need to explicitly cast NSInteger?

Thanks for the answers.

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)