Page 1 of 1

How do you define a class?

PostPosted: Tue Sep 15, 2009 3:52 am
by Steve
I have been reading through the guide and looking at the examples but I still do not see how we define a class -- it's instance variables -- and it's methods. I would appreciate any help or guidance you may give. I think this can be a great product -- Basic with complete Cocoa Framework access -- cool -- keep up the good work.

Steve

Re: How do you define a class?

PostPosted: Tue Sep 15, 2009 8:00 am
by berndnoetscher
To get a custom class, you only need to create a new file in the IDE. The filename determines the super class and the class name.

file base name = class name
file extension = super class name

example:

myForm.Window

file base name = myForm
file extension = Window

Only a few super classes are allowed now: Window, View, Object

To use it in the global.Object file:

Public Dim f As myForm

accessing somewhere

f.mysub()

A new update will come soon, with code completion ready and bug fixes.

Re: How do you define a class?

PostPosted: Tue Sep 15, 2009 9:17 pm
by Steve
Thanks -- that will let me play with it a bit.

Steve

Re: How do you define a class?

PostPosted: Sun Feb 21, 2010 7:15 pm
by MaxClass
Bernd,

One of the first things I noticed within your example code regarding classes is that your examples leave off the "NS" in front of each of the Cocoa class names. I was not sure if this is by design or was accidentally omitted.

In the "QuickStart" example I had to add in the "NS" to class references in the code examples in order to make it compile.

However it was not necessary to use "NS" in front of "Object" in creating the "code" class. (code.Object)

This could be quite confusing to beginners with Objective-Basic such as I.

Your help on this subject would be greatly appreciated.

MaxClass

Re: How do you define a class?

PostPosted: Mon Feb 22, 2010 9:27 am
by berndnoetscher
MaxClass wrote:Bernd,

One of the first things I noticed within your example code regarding classes is that your examples leave off the "NS" in front of each of the Cocoa class names. I was not sure if this is by design or was accidentally omitted.

In the "QuickStart" example I had to add in the "NS" to class references in the code examples in order to make it compile.

However it was not necessary to use "NS" in front of "Object" in creating the "code" class. (code.Object)

This could be quite confusing to beginners with Objective-Basic such as I.

Your help on this subject would be greatly appreciated.

MaxClass


Well, you are right and it is a mistake as you read the language reference.
I will check it out today and upload a new version. Thanks for your comments :-)