Drawing in Objective Basic

Coding Questions, IDE related or anything else

Drawing in Objective Basic

Postby garethbaker » Fri Feb 19, 2010 5:03 pm

I've had a look at the documentation and can't seem to find any references to drawing (LineTo.. MoveTo.. BezierPath.. etc.). Are these available yet?

Thanks
Gareth
garethbaker
 
Posts: 2
Joined: Mon Feb 15, 2010 4:50 pm

Re: Drawing in Objective Basic

Postby MaxClass » Sun Feb 21, 2010 7:21 pm

Bernd,

As asked by "garethbaker" is it possible to use calls to Core Graphics directly within Objective-Basic?

If so could you please post a few simple examples that would show the general syntax for accessing these methods. Once we know the proper syntax the rest should be quite easy.

Thank you in advance for your reply.

MaxClass
MaxClass
 
Posts: 3
Joined: Sun Feb 21, 2010 1:16 am

Re: Drawing in Objective Basic

Postby berndnoetscher » Mon Feb 22, 2010 9:31 am

garethbaker wrote:I've had a look at the documentation and can't seem to find any references to drawing (LineTo.. MoveTo.. BezierPath.. etc.). Are these available yet?

Thanks
Gareth


NSBezierPath and Co are not directly supported yet, but it is possible to do so by using "Declare" statements to extend the language features of Objective-Basic.
Check out the example "Objective-C", it shows how to directly use Cocoa.

You need a NSView and with a

Code: Select all
Event DrawRect(r As Rect)

  '  custom Objective-C calls with Declare

End Event



NSBezierPath and Co will be supported in future of course.
berndnoetscher
Site Admin
 
Posts: 280
Joined: Fri Feb 20, 2009 11:58 am

Re: Drawing in Objective Basic

Postby garethbaker » Mon Feb 22, 2010 9:31 pm

Thanks for the reply.

I've got a simple blue rectangle in a subclassed view!

One minor problem. Within the DrawRect Event this produces an error:

Dim colour As NSColor

If I do

Dim colour As NSColor = BlueColor

It works

The error is:
"Double expected"
Looking in the Objective-C code the declaration for the NSColor has - id colour = _NSCOLOR(NSCOLOR(0, 0, 0, 0));

Regards
Gareth
garethbaker
 
Posts: 2
Joined: Mon Feb 15, 2010 4:50 pm

Re: Drawing in Objective Basic

Postby berndnoetscher » Tue Feb 23, 2010 10:02 am

Well done!

I tried to have the error message, you described, but I still don't get it.

Could you please post your code to me (bernd@kbasic.com) or the forum?
Thanks in advance.

Kind regards,
Bernd
berndnoetscher
Site Admin
 
Posts: 280
Joined: Fri Feb 20, 2009 11:58 am

Re: Drawing in Objective Basic

Postby berndnoetscher » Wed Feb 24, 2010 9:58 am

Gareth,

thanks for your help. I managed to find the small bug. It is fixed now and I uploaded a new version.

Kind regards,
Bernd
berndnoetscher
Site Admin
 
Posts: 280
Joined: Fri Feb 20, 2009 11:58 am


Return to Objective-Basic (Xcode 3)

Who is online

Users browsing this forum: No registered users and 0 guests

cron