Framework

 

First Edition

This edition applies to release 1.2 of Objective-Basic and to all subsequent released and modfications until otherwise indicated in new editions. Make sure you are using the correct edtion for the level fo the product. The term "Objective-Basic" as used in this publication, refers to the Objective-basic prodcut set (January 2007).



 


Objective-Basic Framework 1.2

(C)opyright Bernd Noetscher's KBasic Software 2007. All rights resreved.

The Objective-Basic Framework is not just a wrapper around the Cocoa Frameworks.

It simplifies the using of Cocoa, but does not add overhead to its functionality, because all calls to it are replaced by native calls to Cocoa.
It enables you to easily write Cocoa applications using BASIC syntax and commands.

WARNING! You may use Objective-Basic Frameworks classes as local variables only now:

Array, Data, Dictionary, FileHandle, FileManager, Task, ProcessInfo, Variant, String, Timer

Contents


Foundation/Array
Foundation/Data
Foundation/Dictionary
Foundation/FileHandle
Foundation/FileManager
Foundation/Object
Foundation/ProcessInfo
Foundation/String
Foundation/Task

Foundation/Timer
Foundation/Variant

Foundation/Bundle
Foundation/Date
Foundation/DateComponents
Foundation/DateFormatter
Foundation/CalendarDate
Foundation/Calendar
Foundation/TimeZone
Foundation/AppleScript
Foundation/AutoreleasePool
Foundation/Notification
Foundation/NotificationCenter
Foundation/Thread
Foundation/Null
Foundation/RunLoop
Foundation/UserDefaults
Foundation/NumberFormatter
Foundation/Stream
Foundation/OutputStream
Foundation/InputStream
Foundation/Pipe
Foundation/Locale
Foundation/DecimalNumber
Foundation/Foundation Types
Foundation/Foundation Functions
Foundation/Math


Applikation Kit/Event
Applikation Kit/Responder
Applikation Kit/View
Applikation Kit/Control
Applikation Kit/Window
Applikation Kit/Toolbar
Applikation Kit/Workspace
Applikation Kit/ToolbarItem
Applikation Kit/SavePanel
Applikation Kit/OpenPanel
Applikation Kit/Box
Applikation Kit/Button
Applikation Kit/Panel
Applikation Kit/Alert
Applikation Kit/MenuItem
Applikation Kit/Menu
Applikation Kit/HelpManager
Applikation Kit/Drawing
Applikation Kit/Sound
Applikation Kit/Application
Applikation Kit/Applikation Kit Functions

[Foundation]

For Internet, Socket, Port, URL, FTP, (http, DNS, TCP/IP and Network, please read and use the original documents about the Cocoa classes:

NSHost

NSHTTPCookie

NSHTTPCookieStorage

NSHTTPURLResponse

NSNetService

NSNetServiceBrowser

NSPort

NSPortCoder

NSPortMessage

NSPortNameServer

NSSocketPort

NSSocketPortNameServer

NSURL

NSURLAuthenticationChallenge

NSURLCache

NSURLConnection

NSURLCredential

NSURLCredentialStorage

NSURLDownload

NSURLHandle

NSURLProtectionSpace

NSURLProtocol

NSURLRequest

NSURLResponse

NSCachedURLResponse


For XML programming, please read and use the original documents about the Cocoa classes:

NSXMLDocument

NSXMLDTD

NSXMLDTDNode

NSXMLElement

NSXMLNode

NSXMLParser


Localized String Handling

NSLocalizedString

NSLocalizedStringFromTable

NSLocalizedStringFromTableInBundle

NSLocalizedStringWithDefaultValue


For distributed object communication, please read and use the original documents about the Cocoa classes. Normally, you won't use it:

NSConnection

NSInvocation


Map Tables provides very fast dictionaries containing pointers. Normally, you won't use it, because you use Dictionary instead.

NSAllMapTableKeys

NSAllMapTableValues

NSCompareMapTables

NSCopyMapTableWithZone

NSCountMapTable

NSCreateMapTable

NSCreateMapTableWithZone

NSEndMapTableEnumeration

NSEnumerateMapTable

NSFreeMapTable

NSMapGet

NSMapInsert

NSMapInsertIfAbsent

NSMapInsertKnownAbsent

NSMapMember

NSMapRemove

NSNextMapEnumeratorPair

NSResetMapTable

NSStringFromMapTable



Foundation/Array IsA Cocoa/Foundation/NSMutableArray Inherits Object Groups

The Array class manages collections of objects called arrays. It is a modifiable array of objects.

You can create, load, save, copy, insert, delete, iterate and sort.

Objects that you add to an array are referenced only. Each object receives a retain message before its id is added to the array.

When an object is removed from an array, it's sent a release message. That means that Array takes no ownership about the objects.


Original documentation can be read here
Original documentation can be read here

Len() As Unsigned

Set(Unsigned, id)

Get(Unsigned) As id

[Unsigned] As id (read/write) --> index

= Array

Contains(id) As Boolean (Returns True if a given object is contained)

GetArray(Unsigned, Unsigned) As Array (Returns a new array with objects from the specified range)

For Each id In Array --> Enumerator

Next

For Unsigned To Len()

Next

LoadFile(String) As Array

SaveFile(String) As Boolean

Append(id) (Appends a given object at the end)

AppendArray(Array) (Appends a given array's objects at the end)

Insert(Unsigned, id) (Inserts a given object at index)

Replace(Unsigned, id) (Replaces with a given object at index)

IndexOf(id) As Unsigned (Returns the index position of given object)

RemoveAll() (Removes all objects)

Remove(id) (Removes a given object)

RemoveAt(Unsigned) (Removes the object at index)


Foundation/Data IsA Cocoa/Foundation/NSMutableData Inherits Object Groups

A Data object is an object-oriented wrappers for byte buffers.
Original documentation can be read here
Original documentation can be read here

= Data

LoadFile(String) As Data

SaveFile(String) As Boolean

Len() As Unsigned

Set(Unsigned, AnyType)

Get(Unsigned) As AnyType

Get(at As Unsigned, length As Unsigned) As String

[Unsigned] As AnyType(read/write) --> index

[at As Unsigned, length As Unsigned] As String (read) --> index

GetData(Unsigned, Unsigned) As Data (Returns a new data with bytes from the specified range)

For Unsigned To Len()

Next

Append(AnyType) (Adds bytes at the end)

AppendData(Data) (Adds a given data's bytes at the end)

ResetFromTo(Unsigned, Unsigned) (Resets the bytes in a given range)

ReplaceFromToWithData(Unsigned, Unsigned, Data) (Replaces the bytes in a given range)



Foundation/Dictionary IsA Cocoa/Foundation/NSMutableDictionary Inherits Object Groups

The Dictionary class manages collections of objects stored as key/value pairs. It is a modifiable.

You can create, load, save, copy, insert, delete, iterate and sort.

Objects that you add to an dictionary are referenced only. Each object receives a retain message before its id is added to the dictionary.

When an object is removed from an dictionary, it's sent a release message. That means that Dictionary takes no ownership about the objects.
Original documentation can be read here
Original documentation can be read here

[String] read/write As id --> key/value

Len() As Unsigned

Set(String, id)

Get(String) As id

= Dictionary

For Each id In Dictionary --> Enumerator

Next

LoadFile(String) As Dictionary

SaveFile(String) As Boolean

Keys() As Array (Returns an array containing all keys)

Values() As Array (Returns an array containing all values)

RemoveAll() (Removes all objects)

Remove(String) (Removes a given object)

AppendDictionary(Dictionary) (Adds at the end)


Foundation/FileHandle IsA Cocoa/Foundation/NSFileHandle Inherits Object Groups

FileHandle is for accessing open files or communications channels.
Original documentation can be read here

Static ForReading(String) As id (Returns a file handle initialized for reading the file, device, or named socket at the specified path.)

Static ForWriting(String) As id (Returns a file handle initialized for writing the file, device, or named socket at the specified path.)

Static ForUpdating(String) As id (Returns a file handle initialized for writing or reading the file, device, or named socket at the specified path.)

Static StandardError() As id (Returns the file handle for the standard error file.)

Static StandardInput() As id (Returns the file handle for the standard input file.)

Static StandardOutput() As id (Returns the file handle with the standard output file.)

Static NullDevice() As id (Returns the file handle for the null device.)

ReadAll() As Data (Read to end of file)

ReadOfLen(Unsigned) As Data (Read length bytes)

Write(Data) (Write to file)

Close() (Closes the file handle)

Len() As Long

SetOffset(Long)

Offset() As Long


Foundation/FileManager IsA Cocoa/Foundation/NSFileManager Inherits Object Groups

FileManager helps you to do many generic file-system operations in a smart way.
Original documentation can be read here

SetCurrentDirectory(String)

CurrentDirectory() As String

CreateDirectory(String, Dictionary) As Boolean

Copy(String, String) As Boolean (Copies a directory or file)

CreateFile(String, Dictionary) As Boolean

CreateFileWithData(String, Dictionary, Data) As Boolean

Move(String, String) As Boolean (Moves a directory or file)

Link(String, String) As Boolean (Links a directory or file)

Remove(String) As Boolean (Deletes the directory (including all subdirectories and contained files and links), link, or file)

ReadFile(String) As Data (Reads the content of a file)

FileExists(String) As Boolean (Returns True if file exists)

DirectoryExists(String) As Boolean (Returns True if directory exists)

IsFileReadable(String) As Boolean (Returns True if readable for current user)

IsFileWriteable(String) As Boolean (Returns True if writeable for current user)

IsFileExecutable(String) As Boolean (Returns True if executable for current user)

IsFileDeletable(String) As Boolean (Returns True if file deletable for current user)

IsDirectoryReadable(String) As Boolean (Returns True if readable for current user)

IsDirectoryWriteable(String) As Boolean (Returns True if writeable for current user)

IsDirectoryDeletable(String) As Boolean (Returns True if deletable for current user)

FilesystemAttributes(String) As Dictionary (See Cocoa/NSFileManager documentation for possible attributes)

FileAttributes(String, traverseLink As Boolean) As Dictionary (See Cocoa/NSFileManager documentation for possible attributes)

SetFileAttributes(String, Dictionary) As Boolean (See Cocoa/NSFileManager documentation for possible attributes. You can change single attributes; you need not specify keys for all attributes)

DirectoryAttributes(String, traverseLink As Boolean) As Dictionary (See Cocoa/NSFileManager documentation for possible attributes)

SetDirectoryAttributes(String, Dictionary) As Boolean (See Cocoa/NSFileManager documentation for possible attributes. You can change single attributes; you need not specify keys for all attributes)

ReadDirectory(String) As Array (Returns an array of String objects containing the paths of files and directories, but not following links and subdirectories)

ReadDirectories(String) As Array (Returns an array of String objects containing the paths of files and directories, including following links and subdirectories)

CreateSymbolicLink(String, String) As Boolean

ReadSymbolicLink(String) As String (Returns the actual path of the link)


Foundation/Object IsA Cocoa/Foundation/NSObject AndContains Groups

Object is the root class of most Objective-Basic classes. Using Object as parent class, objects inherit an interface to the runtime system.
Original documentation can be read here

Autorelease() (Appends the receiver to the autorelease pool)

Release() (Decrements the reference count)

Retain() (Increments the reference count)


Foundation/ProcessInfo IsA Cocoa/Foundation/NSProcessInfo Inherits Object Groups

ProcessInfo informs you about the current running process.
Original documentation can be read here

Arguments() As Array (read) (Returns the command-line arguments as array of Strings)

Environment() As Dictionary (read) (Returns the variable names and their values in the environment)


Foundation/String IsA Cocoa/Foundation/NSMutableString Inherits Object Groups

The Objective-Basic String class.
Original documentation can be read here

= String

+ (String concatination)

= (compare) -> equal

Like (compare) -> equalCaseInsensitive

If "hello" Like "HELLO" Then

Print()

AppendStringInFormat(format As String, String ...) As String

Format styles are:

------------------------------------------------------------------------

%@ Objective-Basic object, printed as the string

%% '%' character

%i Integer

%u Unsigned

%qi Long

%x Unsigned, printed in hexadecimal using the digits 0-9 and lowercase a-f

%X Unsigned, printed in hexadecimal using the digits 0-9 and uppercase A-F

%f 64-bit floating-point number (Double)

%e 64-bit floating-point number (Double), printed in scientific notation using a lowercase e to introduce the exponent

%E 64-bit floating-point number (Double), printed in scientific notation using an uppercase E to introduce the exponent

%g 64-bit floating-point number (Double), printed in the style of %e if the exponent is less than -4 or greater than or equal to the precision, in the style of %f otherwise

%G 64-bit floating-point number (Double), printed in the style of %E if the exponent is less than -4 or greater than or equal to the precision, in the style of %f otherwise

%S Null-terminated array of 16-bit Unicode characters (String)

------------------------------------------------------------------------

Left(Unsigned) As String

Right(Unsigned) As String Mid(Unsigned, Length As Unsigned) As String

Split(separator As String) As Array

Join(Array, separator As String) As String
Trim() As String

IndexOfString([startPos As Unsigned, ] String) As Unsigned

IndexOfStringCaseInsensitive([startPos As Unsigned, ] String) As Unsigned

LastIndexOfString([startPos As Unsigned, ] String) As Unsigned

LastIndexOfStringCaseInsensitive([startPos As Unsigned, ] String) As Unsigned
LowercaseString() As String
UppercaseString() As String

Len() As Unsigned

ReplaceString(String, with As String) As Unsigned ReplaceStringCaseInsensitive(String, with As String) As Unsigned

BeginsWith(String) As Boolean

EndsWith(String) As Boolean

AsUTF8String() AsConstRef Char

AsSingle() As Single

AsDouble() As Double

AsInteger() As Integer
LoadFile(String) As String

SaveFile(String) As Boolean


Foundation/Task IsA Cocoa/Foundation/NSTask Inherits Object Groups

Task enables you to run another program as a subprocess and monitor that program's execution.
Original documentation can be read here

SetStandardError(id)

StandardError() As id

SetStandardInput(id)

StandardInput() As id

SetStandardOutput(id)

StandardOutput() As id

SetPath(String)

Path() As String

SetArguments(Dictionary)

Arguments() As Dictionary

Launch() As Boolean

Resume() As Boolean

Suspend() As Boolean

Terminate() As Boolean

WaitUntilExit()

IsRunning() As Boolean

TerminationStatus() As Integer


Foundation/Timer IsA Cocoa/Foundation/NSTimer Inherits Object Groups

A timer waits until a certain time interval has elapsed and then calls a specified method.
Original documentation can be read here

Start(Double)

Stop()

{

Dim t As Timer

t.start(1000)

Sub t_TimerEvent(y As Timer)

' write your event code here

End Sub

}


Foundation/Variant IsA Cocoa/Foundation/NSValue Inherits Object Groups

Object wrapper for primitive types like Integer or Boolean. Please notice, that Variant is useful only, if you need to store primitive types in an Array or Dictionary,

because it acts like a reference object to the original primitive type. It stores a C pointer to it, instead of copying the value of the primitive type. This means that

the primitive type must always be available, when your are using it in a Variant.
Original documentation can be read here

= Size

= Rect

= Point

= Boolean

= Integer

= Long

= Signed

= Unsigned

= Single

= Double

= String

= id

AsSize As Size

AsRect As Rect

AsPoint As Point

AsString As String

Asid As id

AsBoolean As Boolean

AsSigned As Signed

AsUnsigned As Unsigned

AsInteger As Integer

AsLong As Long

AsSingle As Single

AsDouble As Double


Foundation/Bundle IsA Cocoa/Foundation/NSBundle Inherits Object Groups

A Bundle contains code and resources that can be used in your program. With its help you can locate program resources,

dynamically load executable code, and assist in localization.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/Date IsA Cocoa/Foundation/NSDate Inherits Date, Object Groups

Very useful for working with dates.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/DateComponents IsA Cocoa/Foundation/NSDateComponents Inherits Object Groups

Very useful for working with dates.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/DateFormatter IsA Cocoa/Foundation/NSDateFormatter Inherits Formatter, Object Groups

Very useful for working with dates.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/CalendarDate IsA Cocoa/Foundation/NSDateComponents Inherits Date, Object Groups

Very useful for working with dates.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/Calendar IsA Cocoa/Foundation/NSCalendar Inherits Object Groups

Very useful for working with dates.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/TimeZone IsA Cocoa/Foundation/NSTimeZone Inherits Object Groups

Very useful for working with time zones.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/AppleScript IsA Cocoa/Foundation/NSAppleScript Inherits Object Groups

It gives you the ability to load, compile, and execute apple scripts.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/AutoreleasePool IsA Cocoa/Foundation/NSAutoreleasePool Inherits Object Groups

It is used to implement the autorelease mechanism.

An autorelease pool stores objects that are released when the pool itself is released.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/Notification IsA Cocoa/Foundation/NSNotification Inherits Object Groups

Needed to use the Cocoa notification mechanism.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/NotificationCenter IsA Cocoa/Foundation/NSNotificationCenter Inherits Object Groups

Needed to use the Cocoa notification mechanism.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/Thread IsA Cocoa/Foundation/NSThread Inherits Object Groups

It controls a thread.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/Null IsA Cocoa/Foundation/NSNull Inherits Object Groups

Used to represent null values in collections (which don't allow nil as value).
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/RunLoop IsA Cocoa/Foundation/NSRunLoop Inherits Object Groups

Manually managing the events in your application.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/UserDefaults IsA Cocoa/Foundation/NSUserDefaults Inherits Object Groups

Enables you to interacting with the defaults system.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/NumberFormatter IsA Cocoa/Foundation/NSNumberFormatter Inherits Formatter, Object Groups

Number formatting functionality.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/Stream IsA Cocoa/Foundation/NSStream Inherits Formatter, Object Groups

Number formatting functionality.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/OutputStream IsA Cocoa/Foundation/NSOutputStream Inherits Stream, Object Groups

Number formatting functionality.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/InputStream IsA Cocoa/Foundation/NSInputStream Inherits Stream, Object Groups

Number formatting functionality.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/Pipe IsA Cocoa/Foundation/NSPipe Inherits Object Groups

Enables you to use pipes.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/Locale IsA Cocoa/Foundation/NSLocale Inherits Object Groups

Enables you to use pipes.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/DecimalNumber IsA Cocoa/Foundation/NSDecimalNumber Inherits Object Groups

Decimal number handling.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Foundation/Foundation Types IsA BasedOn Cocoa/Foundation/
Original documentation can be read here

Size IsA NSSize

Rect IsA NSRect

Point IsA NSPoint


Foundation/Foundation Functions IsA BasedOn Cocoa/Foundation/
Original documentation can be read here

Print(Format As String, String...) (Prints a message to stderr. Based on NSLog)

Format styles are:

------------------------------------------------------------------------

%@ Objective-Basic object, printed as the string

%% '%' character

%i Integer

%u Unsigned

%qi Long

%x Unsigned, printed in hexadecimal using the digits 0-9 and lowercase a-f

%X Unsigned, printed in hexadecimal using the digits 0-9 and uppercase A-F

%f 64-bit floating-point number (Double)

%e 64-bit floating-point number (Double), printed in scientific notation using a lowercase e to introduce the exponent

%E 64-bit floating-point number (Double), printed in scientific notation using an uppercase E to introduce the exponent

%g 64-bit floating-point number (Double), printed in the style of %e if the exponent is less than -4 or greater than or equal to the precision, in the style of %f otherwise

%G 64-bit floating-point number (Double), printed in the style of %E if the exponent is less than -4 or greater than or equal to the precision, in the style of %f otherwise

%S Null-terminated array of 16-bit Unicode characters (String)

------------------------------------------------------------------------

FullUserName() As String (Returns the full name of the current user)

HomeDirectory() As String (Returns the path to the current user's home directory)

HomeDirectoryForUser(user As String) As String (Returns the home directory path for a given user)

TemporaryDirectory() As String (Returns the temporary directory)

UserName() As String (Returns the name of the current user (logon name))

EqualPoints(aPoint As Point, bPoint As Point) As Boolean (Returns true if two points are equal)

MakePoint(x As Single, y As Single) As Point (Returns a point by x and y)

EqualRects(aRect As Rect, bRect As Rect) As Boolean (Returns true if two rects are equal)

MakeRect(x As Single, y As Single, Width As Single, Height As Single) As Rect (Returns a rect by x, y, width and height)

EqualSizes(aSize As Size, bSize As Size) As Boolean (Returns true if two sizes are equal)

MakeSize(Width As Single, Height As Single) As Size (Returns a size by width and height)

Not implemented yet:

+ Randomize() (Initalize the random generator)

+ Rnd() As Double (Get new random value)

+ RaiseException(Name As String, Description As String, Information As Dictionary) (Creates and throws an new user exception)


Foundation/Math IsA BasedOn Carbon/CoreServices

You can use the following functions to perform mathematical and logical operations.

All of these functions are compatible to IEEE 754 and deal with exceptions, NaNs, positive and negative zero and infinity consistent with the floating-point standard.

Normally, you need only a few functions.
Original documentation can be read here

You have to write Import "Math" on top of your file, if you would like to use the following math functions.


Constants:

HUGE_VAL (IEEE 754 value of infinity)

INFINITY (IEEE 754 value of infinity)

NAN (A generic NaN (Not A Number))

Normally, you do not need the following constants.

FP_SNAN

FP_QNAN

FP_INFINITE

FP_ZERO

FP_NORMAL

FP_SUBNORMAL

SIGDIGLEN (decimal digits)

DECSTROUTLEN (maximum length for dec2str)

FLOATDECIMAL

FIXEDDECIMAL

Types:

deprecated/backward compatibiltiy:

Type Decimal (A type which provides decimal numeric type as float or fixed type)

sgn As Char (sign 0 for +, 1 for -)

unused As Char

exp As Short Integer (decimal exponent)

sig.length As Unsigned Char

sig.text As Unsigned Char * SIGDIGLEN

sig.unused As Unsigned Char

End Type

deprecated/backward compatibiltiy:

Type Decform (Determines conversions to decimal strings. If FLOATDECIMAL, the value of the field digits is the number of significant digits. If FIXEDDECIMAL value of the field digits is the number of digits to the right of the decimal point)

style As Char (FLOATDECIMAL or FIXEDDECIMAL)

unused As Char

digits As Short Integer

End Type

Type Fract (32 bit Integer type)

Type Fixed (32 bit Integer type)

Converting:

Fix2Frac(Fixed) As Frac

Fix2Integer(Fixed) As Integer

Frac2Fix(Frac) As Fixed

Integer2Fix(Integer) As Fixed

FixedToSingle(Fixed) As Single

FractToSingle(Fract) As Single

SingleToFixed(Single) As Fixed

SingleToFract(Single) As Fract

Fix2Double(Fixed) As Double

Frac2Double(Fract) As Double

Double2Fix(Double) As Fixed

Double2Frac(Double) As Fract

Converting Between Fixed-Point and Integral Values:

FixRatio(numer As Integer, denom As Integer) As Fixed

FixRound(Fixed) As Integer

Multiplying and Dividing Fixed-Point Numbers:

FixDiv(x As Fixed | Fract | Long, y As Fixed | Fract | Long) As Fixed

FixMul(x As Fixed | Fract | Long, y As Fixed | Fract | Long) As Fixed

FracDiv(x As Fixed | Fract | Long, y As Fixed | Fract | Long) As Fract

FracMul(x As Fixed | Fract | Long, y As Fixed | Fract | Long) As Fract

Performing Calculations on Fixed-Point Numbers:

FixATan2(x As Integer, y As Integer) As Fixed

FracCos(Fixed) As Fract

FracSin(Fixed) As Fract

FracSqrt(Fract) As Fract

Performing Logical Operations:

BitAnd(Integer, Integer) As Integer

BitNot(Integer) As Integer

BitOr(Integer, Integer) As Integer

BitShift(Value As Integer, Count As Integer) As Integer

BitXor(Integer, Integer) As Integer

Testing and Setting Bits:

BitClr(AsRef Byte, Integer)

BitSet(AsRef Byte, Integer)

BitTst(AsRef Byte, Integer) As Boolean

Trigonometric functions:

cos(x As Double) As Double

sin(x As Double) As Double

tan(x As Double) As Double

acos(x As Double) As Double (Result is in [0,pi])

asin(x As Double) As Double (Result is in [-pi/2,pi/2])

atan(x As Double) As Double (Result is in [-pi/2,pi/2])

atan2(y As Double, x As Double) As Double (Determines the arc tangent of y/x in [-pi,pi] using the sign of both arguments to determine the quadrant)

Hyperbolic functions:

cosh(x As Double) As Double

sinh(x As Double) As Double

tanh(x As Double) As Double

acosh(x As Double) As Double

asinh(x As Double) As Double

atanh(x As Double) As Double

Exponential functions:


exp(x As Double) As Double

expm1(x As Double) As Double (expm1(x) is more accurate than exp(x) - 1)

exp2(x As Double) As Double

frexp(x As Double, exponent AsRef Integer) As Double (Convert a floating-point number into a normalized fraction and an integral power of 2 and stores the Integer in exponent)

ldexp(x As Double, int n) As Double (Multiplies a floating-point by an integer power of 2)

log(x As Double) As Double

log2(x As Double) As Double

log1p(x As Double) As Double (log1p = log(1 + x). However, for small enough arguments, log1p is more accurate than log(1 + x))

log10(x As Double) As Double

logb(x As Double) As Double (Gets the exponent of its argument, as a signed integral value.)

modf(x As Double, iptr AsRef Double) As Double (Returns fractional part of x as function result and returns integral part in iptr)

modff(x As Single, float *iptrf) As Single

scalb(x As Double, n As Integer) As Double (Determines x * 2^n fast)

Power and absolute value functions:


fabs(x As Double) As Double

hypot(x As Double, y As Double) As Double (Determines the square root of the sum of the squares of its arguments)

pow(x As Double, y As Double) As Double (Returns x raised to the power of y)

sqrt(x As Double) As Double

Gamma and Error functions:


erf(x As Double) As Double (The error function)

erfc(x As Double) As Double (Complementary error function)

gamma(x As Double) As Double (The gamma function)

lgamma(x As Double) As Double (Determines the base-e logarithm of the absolute value of gamma of its argument x, for x > 0)

Nearest integer functions:

ceil(x As Double) As Double

floor(x As Double) As Double

rint(x As Double) As Double (Rounds its argument to an integral value in floating point format, using the current rounding direction)

nearbyint(x As Double) As Double (Does not raise the inexact exception)

rinttol(x As Double) As Integer (Rounds its argument to the nearest Integer using the current rounding direction)

round(x As Double) As Double

roundtol(double_t round) As Integer

trunc(x As Double) As Double (Determines the integral value, in floating format)

Remainder functions:

fmod(x As Double, y As Double) As Double

remainder(x As Double, y As Double) As Double

remquo(x As Double, y As Double, int *quo) As Double (SANE remainder)

Auxiliary functions:

copysign(x As Double, y As Double) As Double

nan(tagp AsConstRef Char) As Double

nanf(tagp AsConstRef Char) As Single

nextafterd(x As Double, y As Double) As Double

nextafterf(x As Single, float y) As Single

pi() As Double

Inquiry macros:

fpclassify(x As Double) As Integer (Returns one of the FP_* values)

isnormal(x As Double) As Integer (Non-zero if and only if the argument x is normalized)

isfinite(x As Double) As Integer (Non-zero if and only if the argument x is finite)

isnan(x As Double) As Integer (Non-zero if and only if the argument x is a NaN)

signbit(x As Double) As Integer (Non-zero if and only if the sign of the argument x is negative)

inf() As Double

Max, Min and Positive Difference:

fdim(x As Double, y As Double) As Double (Computes the 'positive difference' between its arguments)

fmax(x As Double, y As Double) As Double (Returns the maximum of the two arguments)

fmin(x As Double, y As Double) As Double (Returns the minimum of the two arguments)

Financial functions:

compound(rate As Double, periods As Double) As Double (Computes the compound interest factor "(1 + rate)^periods")

annuity(rate As Double, periods As Double) As Double (Computes the present value factor for an annuity "(1 - (1 + rate)^(-periods)) /rate")

Random function:

randomx(x AsRef Double) As Double (A pseudorandom number generator)

Relational operator:

relation(x As Double, y As Double) As Integer (Returns GREATERTHAN, LESSTHAN, EQUALTO or UNORDERED)

Binary to decimal conversions (deprecated/backward compatibiltiy):

num2dec(f AsConstRef Decform, x As Double, d AsRef Decimal) (Converts a Double to a Decimal using a Decform)

dec2num(d AsConstRef Decimal) As Double (Converts a Decimal to a Double value)

dec2str(f AsConstRef Decform, d AsConstRef Decimal, s AsRef Char) (Converts a Decform and Decimal to a C-String)

str2dec(s AsConstRef Char, ix AsRef Short Integer, d AsRef Decimal, vp AsRef Short Integer) (Converts a C-String to a Decimal)

dec2d(d AsConstRef Decimal) As Double (Similar to dec2num)

dec2i(d AsConstRef Decimal) As Integer (Similar to dec2num except an Integer is returned)

[Applikation Kit]

For OpenGL, please read and use the original documents about the Cocoa classes:

NSOpenGLContext

NSOpenGLPixelBuffer

NSOpenGLPixelFormat

NSOpenGLView



Applikation Kit/Event IsA Cocoa/Applikation Kit/NSEvent Inherits Object Groups Control

An event contains information about an input action such as a mouse click or a key down.
Original documentation can be read here


general event information:

context() As GraphicsContext

locationInWindow() As Point

modifierFlags() As Unsigned

type() As NSEventType

window() As Window

windowNumber() As Integer

key event information:

characters() As String

charactersIgnoringModifiers() As String

isARepeat() As Boolean

keyCode() As Integer

mouse event information:


mouseLocation() As Point

buttonNumber() As Integer

clickCount() As Integer

pressure() As Single


Applikation Kit/Responder IsA Cocoa/Applikation Kit/NSResponder Inherits Object Groups Control

Responder is the basis of event and command processing used by most GUI elements.
Original documentation can be read here


first responder:


Override acceptsFirstResponder() As Boolean

Override becomeFirstResponder() As Boolean

Override resignFirstResponder () As Boolean


next responder:


setNextResponder(Responder)

nextResponder() As Responder

events:

Override mouseDown(Event)

Override mouseDragged(Event)

Override mouseUp(Event)

Override mouseMoved(Event)

Override mouseEntered(Event)

Override mouseExited(Event)

Override rightMouseDown(Event)

Override rightMouseDragged(Event)

Override rightMouseUp(Event)

Override otherMouseDown(Event)

Override otherMouseDragged(Event)

Override otherMouseUp(Event)

Override scrollWheel(Event)

Override keyDown(Event)

Override keyUp(Event)

Override flagsChanged(Event)

Override helpRequested(Event)

Override tabletPoint(Event)

Override tabletProximity(Event)


Applikation Kit/View IsA Cocoa/Applikation Kit/NSView Inherits Responder, Object Groups Control

View defines the basic drawing, event-handling, and printing architecture of an application.
Original documentation can be read here

superview() As View

subviews() As Array

window() As Window

viewWithTag(Integer) As id

tag() As Integer

setFrame(Rect)

frame() As Rect

setBounds(Rect)

bounds() As Rect

Static focusView() As View

setNeedsDisplay(Boolean)

setHidden(Boolean)

isHidden() As Boolean

Override drawRect(Rect)

Override isOpaque() As Boolean

setToolTip(String)

toolTip() As String

Override menuForEvent(Event) As Menu


Applikation Kit/Control IsA Cocoa/Applikation Kit/NSControl Inherits View, Responder, Object Groups Control

Control enables you to set and get values.
Original documentation can be read here

isEnabled() As Boolean

setEnabled(Boolean)

doubleValue() As Double

setDoubleValue(Double)

intValue() As Integer

setIntValue(Integer)

objectValue() As id

setObjectValue(id)

stringValue() As String

setStringValue(String)

setNeedsDisplay()

action() As Sel

setAction(Sel)

{ Function actionXYZ(sender As id) As IBAction

}

target() As id

setTarget(id)

cell() As id


Applikation Kit/Window IsA Cocoa/Applikation Kit/NSWindow Inherits Responder, Object Groups Control

Window handles an onscreen window.
Original documentation can be read here

orderBack()

orderFront()

orderOut()

isVisible() As Boolean

addChildWindow(Window, NSWindowOrderingMode)

removeChildWindow(Window)

childWindows() As Array

parentWindow() As Window

setParentWindow(Window)

Override becomeKeyWindow()

canBecomeKeyWindow() As Boolean

isKeyWindow() As Boolean

makeKeyAndOrderFront(id)

makeKeyWindow()

Override resignKeyWindow()

Override becomeMainWindow()

canBecomeMainWindow() As Boolean

isMainWindow() As Boolean

makeMainWindow()

Override resignMainWindow()

display()

makeFirstResponder(Responder)

firstResponder() As Responder

setTitle(String)

title() As String

center()

performZoom(id)

isZoomed() As Boolean

performClose(id)

performMiniaturize(id)

deminiaturize(id)

isMiniaturized() As Boolean

setContentView(View)

contentView() As View

setAlphaValue(Single)

alphaValue() As Single

setOpaque(Boolean)

isOpaque() As Boolean

drawers() As Array

setToolbar(Toolbar)

toolbar() As Toolbar

toggleToolbarShown(id)


Applikation Kit/Toolbar IsA Cocoa/Applikation Kit/NSToolbar Inherits Object Groups Control

A toolbar contains toolbaritems.
Original documentation can be read here

delegate() As id

setDelegate(id)

Override toolbar(Toolbar, itemForItemIdentifier As String, willBeInsertedIntoToolbar As Boolean)

Override toolbarAllowedItemIdentifiers(Toolbar) As Array

Override toolbarDefaultItemIdentifiers(Toolbar) As Array

Override toolbarSelectableItemIdentifiers(Toolbar) As Array

runCustomizationPalette(id)

isVisible() As Boolean

setVisible(Boolean)


Applikation Kit/Workspace IsA Cocoa/Applikation Kit/NSWorkspace Inherits Object Groups

Workspace enables you to interact with other applications.
Original documentation can be read here

openFile(String) As Boolean

openFileWithApplication(String, String) As Boolean

launchApplication(String) As Boolean

hideOtherApplications()

iconForFile(String) As NSImage

iconForFileType(String) As NSImage

fullPathForApplication(String) As String

launchedApplications() As Array


Applikation Kit/ToolbarItem IsA Cocoa/Applikation Kit/NSToolbarItem Inherits Object Groups Control

Each item in a toolbar is a toolbaritem.
Original documentation can be read her

label() As String

setLabel(String)

toolTip() As String

setToolTip(String)

tag() As Integer

setTag(Integer)

action() As Sel

setAction(Sel)

{ Function actionXYZ(sender As id) As IBAction

}

target() As id

setTarget(id)

isEnabled() As Boolean

setEnabled(Boolean)

image() As NSImage

setImage(NSImage)


Applikation Kit/SavePanel IsA Cocoa/Applikation Kit/NSSavePanel Inherits Panel, Window, Responder, Object Groups

It enables the user to specify a file to use when saving a document.
Original documentation can be read here

setTitle(String)

setMessage(String)

setDirectory(String)

setAllowedFileTypes(Array)

setRequiredFileType(String)

setTreatsFilePackagesAsDirectories(Boolean)

setCanCreateDirectories(Boolean)

directory() As String

filename() As String

beginSheetForDirectory(path As String, filename As String, modalForWindow As NSWindow, modalDelegate As id, didEndSavePanelSheetForDirectory As Sel, contextInfo AsRef)

Override didEndSavePanelSheetForDirectory(sheet As SavePanel, returnCode As Integer, contextInfo AsRef)


Applikation Kit/OpenPanel IsA Cocoa/Applikation Kit/NSOpenPanel Inherits SavePanel, Panel, Window, Responder, Object Groups

It enables the user to specify a file to use when opening a document.
Original documentation can be read here

setTitle(String)

setMessage(String)

setDirectory(String)

setAllowedFileTypes(Array)

setRequiredFileType(String)

setTreatsFilePackagesAsDirectories(Boolean)

setCanCreateDirectories(Boolean)

setCanChooseFiles(Boolean)

setCanChooseDirectories(Boolean)

setResolvesAliases(Boolean)

setAllowsMultipleSelection(Boolean)

directory() As String

filename() As String

filenames() As Array

beginSheetForDirectory(path As String, filename As String, modalForWindow As NSWindow, modalDelegate As id, didEndOpenPanelSheetForDirectory As Sel, contextInfo AsRef)

Override didEndOpenPanelSheetForDirectory(sheet As OpenPanel, returnCode As Integer, contextInfo AsRef)


Applikation Kit/Box IsA Cocoa/Applikation Kit/NSBox Inherits Object Groups Control

It is used to group, visually, some number of other views with a border around itself and a title. Normally, you do not need to use the programming interface.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Applikation Kit/Button IsA Cocoa/Applikation Kit/NSButton Inherits Control, View, Responder, Object Groups Control

Reacts on mouse-down events and sends an action it's clicked or pressed.
Original documentation can be read here

image() As NSImage (

setImage(NSImage)

setTitle(String)

title() As String

setState(Integer)

state() As Integer

setNextState()

{

more controls are here. See the original Cocoa documentation. More help entries and descriptions will follow:

NSButtonCell

NSBrowser

NSBrowserCell

NSComboBox

NSComboBoxCell

NSDatePicker

NSDatePickerCell

NSForm

NSFormCell

NSImage

NSImageCell

NSLevelIndicator

NSLevelIndicatorCell

NSProgressIndicator

NSMovie

NSMovieView

NSPopUpButton

NSPopUpButtonCell

NSSearchField

NSSearchFieldCell

NSSecureTextField

NSSecureTextFieldCell

NSSlider

NSSliderCell

NSSegmentedCell

NSSegmentedControl

NSCell

NSActionCell

NSStepper

NSStepperCell

NSStatusBar

NSStatusItem

NSTableColumn

NSTableHeaderCell

NSTableHeaderView

NSTableView

NSTabView

NSTabViewItem

NSTextField

NSTextFieldCell

NSTokenField

NSTokenFieldCell

NSOutlineView

NSScrollView

NSSplitView

NSColor

NSFont

NSBundle

NSCursor

NSDrawer

NSGraphicsContext

NSMatrix

--------

NSColorPanel

NSFontManager

NSFontPanel

NSPageLayout

NSPasteboard

NSScreen

NSPrinter

NSPrintInfo

NSPrintOperation

NSPrintPanel

NSSpellChecker

NSString Additions

NSText

NSTextAttachment

NSTextAttachmentCell

NSTextBlock

NSTextContainer

NSTextList

NSTextStorage

NSTextTab

NSTextTable

NSTextTableBlock

NSTextView

}


Applikation Kit/Panel IsA Cocoa/Applikation Kit/NSPanel Inherits Window, Responder, Object Groups

It implements a different kind of window, used for a special function in an application.
Original documentation can be read here

setFloatingPanel(Boolean)

isFloatingPanel() As Boolean


Applikation Kit/Alert IsA Cocoa/Applikation Kit/NSAlert Inherits Object Groups

Displays an alert.
Original documentation can be read here

Static alertWithMessageText(messageTitle As String, defaultButtonTitle As String, alternateButtonTitle As String, otherButtonTitle As String, informativeTextWithFormat As String)


Applikation Kit/MenuItem IsA Cocoa/Applikation Kit/NSMenuItem Inherits Object Groups Control

Each item in a menu is a menuitem.
Original documentation can be read here

setEnabled(Boolean)

isEnabled() As Boolean

setAction(Sel)

action() As Sel

{ Function actionXYZ(sender As id) As IBAction

}

setTarget(id)

target() As id

setTitle(String)

title() As String

setTag(Integer)

tag() As Integer

setState(Integer)

state() As Integer

setImage(NSImage)

image() As NSImage

setOnStateImage(NSImage)

onStateImage() As NSImage

setOffStateImage(NSImage)

offStateImage() As NSImage

setMixedStateImage(NSImage)

mixedStateImage() As NSImage

setSubmenu(Menu)

submenu() As Menu

hasSubmenu() As Boolean

Static separatorItem() As MenuItem

isSeparatorItem() As Boolean

setMenu(Menu)

menu() As Menu

setKeyEquivalent(String)

keyEquivalent() As String

setKeyEquivalentModifierMask(Unsigned)

keyEquivalentModifierMask() As Unsigned

setAlternate(Boolean)

isAlternate() As Boolean

setIndentationLevel(Integer)

indentationLevel() As Integer

setToolTip(String)

toolTip() As String


Applikation Kit/Menu IsA Cocoa/Applikation Kit/NSMenu Inherits Object Groups Control

A menu contains of menuitems.
Original documentation can be read here

addItem(MenuItem)

setSubmenu(Menu, forItem As MenuItem)

popUpContextMenu(Menu, Event, View)


Applikation Kit/HelpManager IsA Cocoa/Applikation Kit/NSHelpManager Inherits Object Groups

It enables you to display online help.
Original documentation can be read here

Static sharedHelpManager() As HelpManager

openHelpAnchor(anchor As String, book As String)


Applikation Kit/Drawing IsA Cocoa/Applikation Kit/NSBezierPath Inherits Object Groups Control

Enables you to draw lines and other objects on a graphic context.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Applikation Kit/Sound IsA Cocoa/Applikation Kit/NSSound Inherits Object Groups

Enables you to play playing AIFF, WAV, and NeXT ".snd" files.
Original documentation can be read here

Use the Cocoa functions directly. Please see original help and functions for Cocoa functionality.


Applikation Kit/Application IsA Cocoa/Applikation Kit/NSApplication Inherits Responder, Object Groups

It manages global functions used everywhere in the application.
Original documentation can be read here

Static sharedApplication() As Application

Override finishLaunching() As Boolean

activateIgnoringOtherApps

hideOtherApplications(id)

unhideAllApplications(id)

isActive() As Boolean

deactivate()

keyWindow() As Window

mainWindow() As Window

windowWithWindowNumber(Integer) As Window

windows() As Array

miniaturizeAll(id)

hide(id)

isHidden() As Boolean

unhide(id)

unhideWithoutActivation()

setApplicationIconImage(NSImage)

applicationIconImage() As NSImage

setMainMenu(Menu)

mainMenu() As Menu


Applikation Kit/Applikation Kit Functions IsA BasedOn Cocoa/Applikation Kit/
Original documentation can be read here

Graphics:

CopyBits

CountWindows

CountWindowsForContext

DisableScreenUpdates

DottedFrameRect

DrawBitmap

DrawButton

DrawColorTiledRects

DrawDarkBezel

DrawGrayBezel

DrawGroove

DrawLightBezel

DrawTiledRects

DrawWhiteBezel

DrawWindowBackground

EnableScreenUpdates

EraseRect

FrameRect

FrameRectWithWidth

FrameRectWithWidthUsingOperation

GetWindowServerMemory

HighlightRect

ReadPixel

RectClip

RectClipList

RectFill

RectFillList

RectFillListWithColors

RectFillListWithGrays

RectFillListUsingOperation

RectFillListWithColorsUsingOperation

RectFillUsingOperation

SetFocusRingStyle

ShowAnimationEffect

WindowList

WindowListForContext
Panels:

BeginAlertSheet

BeginCriticalAlertSheet

BeginInformationalAlertSheet

GetAlertPanel

GetCriticalAlertPanel

GetInformationalAlertPanel

ReleaseAlertPanel

RunAlertPanel

RunCriticalAlertPanel

RunInformationalAlertPanel

[Other Cocoa Frameworks]

Please read and use the original documents about the Cocoa frameworks, if you would like to use:

Web Kit

Not useable yet (waiting for support of xdatamodel compilation):

+ Core Data





Copyright © 2007, KBasic Software.
Hosted by KBasic Software.

Products named on this website are trademarks of their respective owners.