Presentation...

Coding Questions, IDE related or anything else

Presentation...

Postby ibobx » Wed Apr 07, 2010 4:15 pm

Hi, my name is Roberto, and I am from Florida, Uruguay.
I am a Software and Web Developer and been using macs for 7 years and developing in the platform for 3 where only 1.5 been Cocoa.
I was introduced to the BASIC world, when I was 10 years old, when I've started playing with the old Spectrums computers and some magazines+books. Then I had some other "BASIC POWERED" computers like the MSX, Atari, Commodore 64, Amiga, and well, had the good luck to live these wonderful years when the BASIC was the best language around :)
With the pass of the time I had to "adapt" to the new programming languages standards, where the first adaptation was Pascal, then C, then C++, JAVA, etc.
When I comes to the Mac World, I've found that there where no Visual Studio with Visual C++ or Visual Basic, or anything like, and the only thing "to develop native apps" at the moment was XCode, so I've needed to "addapt" again and learn Objetive-C + Carbon, and recently, Cocoa.
So resuming, these days, to be more specific "yesterday" :) I was looking around to see whats new out there "with the always hope to find a good BASIC to be used in the Mac", and figure that a good idea was to google "IDE+BASIC+OSX" and between all the results I saw Objetive-Basic! I jumped in right away! And I can tell you, after read just a little, next thing I did was download, register in the forum, and started to play with it! And after some minutes I came out with this little test app called Coin Flipper that uses NSThread and some other controls/functions :D (the download has the source code) where the only problem was the NSLevelIndicators that I was unable to figure how to "setMaxValue" and set the "Value" properties... :)
But anyway, I found this it a great Idea! I need to say thank you because this is what I been looking for years "I know its in beta, and has some work in progress things like debugging..." but actually it works very good! I think Objetive-Basic has a very bright future! Thanks!
:D
"Never trust a computer you can't throw out a window" - ( Woz )
ibobx
 
Posts: 6
Joined: Wed Apr 07, 2010 4:37 am
Location: Florida, Uruguay

Re: Presentation...

Postby berndnoetscher » Thu Apr 08, 2010 4:28 pm

Started some day with BASIC on an Atari ST 1024. :-)

Thanks for your comments and example. I changed it, now it works with maxValue. Attached the code. I would like to ship it with the official examples, may I?

The magic is to use declare to gain yet missing functions of Cocoa.

Code: Select all
Declare Function "NSLevelIndicator"- (void)setMaxValue:(double)maxValue


Code: Select all
'----------------------------------
' COIN FLIPPER - TEST APP
'----------------------------------
    IBOutlet headsNumField As NSTextField
    IBOutlet tailsNumField As NSTextField
    IBOutlet flipNumField As NSTextField
    IBOutlet curFlipField As NSTextField
    IBOutlet headsLevel As NSLevelIndicator
    IBOutlet tailsLevel As NSLevelIndicator
    IBOutlet startButton As NSButton
     
    Dim headsNum As Integer
    Dim tailsNum As Integer
    Dim flipNum As Integer
    Dim curNum As Integer
    Dim isFlipping As Boolean = No
   
    Dim runFlipper As NSThread
   
   
IBAction startFlipping(sender As NSObject)
    If isFlipping = No Then
      startButton.Title = "Stop"
      isFlipping = Yes
      runFlipper=NSThread
      runFlipper.Start()
      runFlipper = Nil
  Else
      runFlipper.Cancel()
      runFlipper=Nil
      startButton.Title = "Start"
      isFlipping = No
    End If
End IBAction

Declare Function "NSLevelIndicator"- (void)setMaxValue:(double)maxValue

Action runFlipper()
  Dim side As Integer
  headsNum = 0
  tailsNum = 0
  curNum = 0
  flipNum = flipNumField.IntegerValue
  Do While isFlipping = Yes And (curNum < flipNum)
   side = Random(2) Mod 2
    If side = 0 Then
      headsNum = headsNum + 1
    Else
      tailsNum = tailsNum + 1
    End If
    tailsNumField.IntegerValue = tailsNum
    headsNumField.IntegerValue = headsNum
    headsLevel.setMaxValue(curNum)
    headsLevel.IntegerValue = headsNum
    tailsLevel.setMaxValue(curNum)
    tailsLevel.IntegerValue = tailsNum
    curNum = curNum + 1
    curFlipField.IntegerValue = curNum
 Loop
  startButton.Title = "Start"
  isFlipping = No
  runFlipper.Cancel()
 End Action       
berndnoetscher
Site Admin
 
Posts: 280
Joined: Fri Feb 20, 2009 11:58 am

Re: Presentation...

Postby ibobx » Thu Apr 08, 2010 5:57 pm

Hi berndnoetscher!
Awesome, Declare hmm I see! :o perfecto!
Work perfect!
Yes you can include it with the examples... :)

Atari ST 1024!! Was the only one I didn't buy because I had the Amiga, but I worked a couple of times with the ST doing some MIDI sequences in a Musician friends house!!! Awesome Machine! :-D


Thanks for all!
"Never trust a computer you can't throw out a window" - ( Woz )
ibobx
 
Posts: 6
Joined: Wed Apr 07, 2010 4:37 am
Location: Florida, Uruguay


Return to Objective-Basic (Xcode 3)

Who is online

Users browsing this forum: No registered users and 0 guests

cron