| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
On 2006-06-03, at 18:09:35, Andreas Kiel wrote:
Hi Andreas,
A full description of what I think you need to know is best left to a good book on the C language. A 'mask' value refers to the setting of specific bits in an integer value. One or more mask values are bitwise inclusive OR'ed together to form a 'flag' value. This 'flag' is an integer value which is passed as a parameter to a C language function. The purpose of the flag parameter is to indicate 0 or more choices the function will branch on to compute its result. The mask values are determined by calculating what the value of an integer would be if certain bits are turned on. The easiest way to visualize this is to run through the bits in the integer sequentially starting from bit 0. So lets say we have a 4 bit integer. Then the computed values from any one of it's bits being ON are: Bit 0 ON = 1 Bit 1 ON = 2 Bit 2 ON = 4 Bit 3 ON = 8 You can see that each value is unique, and furthermore, that each of these values when added to any of the other values will give a unique value. The convention to define the mask values for the grid style in NSTableView uses the binary left shift operator (<<). We can see the integer value of any mask value like those which have been defined above easily in Terminal by using the expr procedure from the Tcl language. Invoke the Tcl interpreter tclsh like so: [me]# tclsh % expr 1 << 0 1 % expr 1 << 1 2 % expr 1 << 2 4 % expr 1 << 3 8 % exit [me]# So finally, we can notice that the computed value for NSTableViewSolidVerticalGridLineMask is 1 and the value for NSTableViewSolidHorizontalGridLineMask is 2. If our situation requires both horizontal and vertical grid lines, then we can supply the flag (gridStyle) in any of the C languages by using the bitwise OR operator (|) to add the two mask values: unsigned int gridStyle = NSTableViewSolidVerticalGridLineMask | NSTableViewSolidHorizontalGridLineMask; But, since AppleScript is brain dead when it comes to bitwise operations, we have to compute the values manually to use them in scripts. That's one area where the traditional scripting languages like Tcl and Perl are much better. HTH, Philip Aker philip->vcn.dot.bc.dot.ca |
_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-studio mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/applescript-studio/email@hidden This email sent to email@hidden
| References: | |
| >Table View and grids (From: Andreas Kiel <email@hidden>) | |
| >Re: Table View and grids (From: Philip Aker <email@hidden>) | |
| >Re: Table View and grids (From: Andreas Kiel <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.