Re: [MacRuby-devel] windowControllerDidLoadNib strangeness

2010-11-26 Thread Thibault Martin-Lagardette
Hi Tom,

I can't seem to understand what is wrong, I guess, since you said everything 
else works, that you did call the necessary `framework "Foundation"`?
Could you maybe provide us some test project, so that we can reproduce and 
maybe trace the error better? :-)

Thank you!
-- 
Thibault Martin-Lagardette



On Nov 26, 2010, at 07:07, Tom Jordan wrote:

> Hello,
> 
> I'm encountering some weird behavior when trying to update a view using  
> windowControllerDidLoadNib after loading in a persistent document.  
> When I provide windowControllerDidLoadNib a single argument, as shown below 
> (and required by the NSDocument class definition and in every example I've 
> seen),
> Xcode says: `windowControllerDidLoadNib:': wrong number of arguments (1 for 
> 0) (ArgumentError)
> If I don't provide any argument, it says: undefined method 
> `windowControllerDidLoadNib' for # (NoMethodError)
> I've tried every combination of one or no args for both the method signature 
> and "super" call on the next line, and I can't seem to get any different 
> results.
> This is my first time trying to get persistence going, but I've read a lot 
> about it, and everything else is working well.. it saves and loads, but I 
> can't seem to get this hook 
> working to update the GUI upon loading.  
> 
> 
> class MyDocument < NSDocument
> 
>   attr_accessor :loadedmodel, :root #outlet to model field of controller
>   
>   # Name of nib containing document window
>   def windowNibName
>   'MyDocument'
>   end
>   
>   # Document data representation for saving (return NSData)
>   def dataOfType(type, error:outError)
>   outError.assign(NSError.errorWithDomain(NSOSStatusErrorDomain, 
> code:-4, userInfo:nil))
>   NSKeyedArchiver.archivedDataWithRootObject(@root.model)
>   end
> 
>   # Read document from data (return non-nil on success)
>   def readFromData(data, ofType:type, error:outError)
>   outError.assign(NSError.errorWithDomain(NSOSStatusErrorDomain, 
> code:-4, userInfo:nil))
>   @loadedmodel = NSKeyedUnarchiver.unarchiveObjectWithData(data)
>   end
> 
>   # Return lowercase 'untitled', to comply with HIG
>   def displayName
>   fileURL ? super : super.sub(/^[[:upper:]]/) {|s| s.downcase}
>   end
> 
>   def windowControllerDidLoadNib(aController) 
>   super(aController)
>   @root.model = @loadedmodel
>   NSLog("model loaded")
>   end
> 
> end
> 
> Regards, 
>  
> Tom Jordan 
> 
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] windowControllerDidLoadNib strangeness

2010-11-26 Thread Laurent Sansonetti
Hi Tom,

I just created a sample NSDocument-based project, and added a 
windowControllerDidLoadNib: method to the NSDocument class, calling super as 
you do, and everything worked as expected.

Could you try that and see if you still see the problem? Also, do you run a 
32-bit machine?

Laurent 

On Nov 25, 2010, at 10:07 PM, Tom Jordan wrote:

> Hello,
> 
> I'm encountering some weird behavior when trying to update a view using  
> When I provide windowControllerDidLoadNib a single argument, as shown below 
> (and required by the NSDocument class definition and in every example I've 
> seen),
> Xcode says: `windowControllerDidLoadNib:': wrong number of arguments (1 for 
> 0) (ArgumentError)
> If I don't provide any argument, it says: undefined method 
> `windowControllerDidLoadNib' for # (NoMethodError)
> I've tried every combination of one or no args for both the method signature 
> and "super" call on the next line, and I can't seem to get any different 
> results.
> This is my first time trying to get persistence going, but I've read a lot 
> about it, and everything else is working well.. it saves and loads, but I 
> can't seem to get this hook 
> working to update the GUI upon loading.  
> 
> 
> class MyDocument < NSDocument
> 
>   attr_accessor :loadedmodel, :root #outlet to model field of controller
>   
>   # Name of nib containing document window
>   def windowNibName
>   'MyDocument'
>   end
>   
>   # Document data representation for saving (return NSData)
>   def dataOfType(type, error:outError)
>   outError.assign(NSError.errorWithDomain(NSOSStatusErrorDomain, 
> code:-4, userInfo:nil))
>   NSKeyedArchiver.archivedDataWithRootObject(@root.model)
>   end
> 
>   # Read document from data (return non-nil on success)
>   def readFromData(data, ofType:type, error:outError)
>   outError.assign(NSError.errorWithDomain(NSOSStatusErrorDomain, 
> code:-4, userInfo:nil))
>   @loadedmodel = NSKeyedUnarchiver.unarchiveObjectWithData(data)
>   end
> 
>   # Return lowercase 'untitled', to comply with HIG
>   def displayName
>   fileURL ? super : super.sub(/^[[:upper:]]/) {|s| s.downcase}
>   end
> 
>   def windowControllerDidLoadNib(aController) 
>   super(aController)
>   @root.model = @loadedmodel
>   NSLog("model loaded")
>   end
> 
> end
> 
> Regards, 
>  
> Tom Jordan 
> 
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] windowControllerDidLoadNib strangeness

2010-11-26 Thread Tom Jordan
Thanks Guys !  I just created a new project and it worked..  Now I'm going
to bring in my files from the other project and see if I can find where it
breaks..
I'm also using the MRGraphics library at:
https://github.com/mattetti/macruby_graphics

It works great to quickly get a custom graphics view going, although I have
noticed some strangeness with IB..
in that whenever I add new widgets to the top level (and only) nib,
I need to delete the custom view that has the MRgraphics, and repaste it
back in, and reconnect it,
or else the newly added widgets won't show up in the build (until you mouse
over to where they're supposed to be and click..
in which case they will appear (sometimes partially if it's a matrix, for
example), and even then they won't function right).

It drove me crazy until I found out that deleting the custom view and
repasting it worked..  although I don't know what I'm going to do
once I need to have more than one custom view and keep adding widgets, etc..
I just wanted to mention this in case
anyone has seen this before.

I'm running 10.6 on a Mac Pro.. which I believe it's 64-bit..
I need to get a Github account or something so that I can post a full
project if need be..

This is a great resource, I appreciate the help.. thanks !

Regards,

Tom Jordan




On Fri, Nov 26, 2010 at 3:42 PM, Laurent Sansonetti
wrote:

> Hi Tom,
>
> I just created a sample NSDocument-based project, and added
> a windowControllerDidLoadNib: method to the NSDocument class, calling super
> as you do, and everything worked as expected.
>
> Could you try that and see if you still see the problem? Also, do you run a
> 32-bit machine?
>
> Laurent
>
>
> On Nov 25, 2010, at 10:07 PM, Tom Jordan wrote:
>
> Hello,
>
> I'm encountering some weird behavior when trying to update a view using
> When I provide windowControllerDidLoadNib a single argument, as shown below
> (and required by the NSDocument class definition and in every example I've
> seen),
> Xcode says: `windowControllerDidLoadNib:': wrong number of arguments (1 for
> 0) (ArgumentError)
> If I don't provide any argument, it says: undefined method
> `windowControllerDidLoadNib' for # (NoMethodError)
> I've tried every combination of one or no args for both the method
> signature and "super" call on the next line, and I can't seem to get any
> different results.
> This is my first time trying to get persistence going, but I've read a lot
> about it, and everything else is working well.. it saves and loads, but I
> can't seem to get this hook
> working to update the GUI upon loading.
>
>
> class MyDocument < NSDocument
>
> attr_accessor :loadedmodel, :root #outlet to model field of controller
>
> # Name of nib containing document window
> def windowNibName
> 'MyDocument'
> end
>
> # Document data representation for saving (return NSData)
> def dataOfType(type, error:outError)
> outError.assign(NSError.errorWithDomain(NSOSStatusErrorDomain, code:-4,
> userInfo:nil))
> NSKeyedArchiver.archivedDataWithRootObject(@root.model)
> end
>
> # Read document from data (return non-nil on success)
> def readFromData(data, ofType:type, error:outError)
> outError.assign(NSError.errorWithDomain(NSOSStatusErrorDomain, code:-4,
> userInfo:nil))
> @loadedmodel = NSKeyedUnarchiver.unarchiveObjectWithData(data)
> end
>
> # Return lowercase 'untitled', to comply with HIG
> def displayName
> fileURL ? super : super.sub(/^[[:upper:]]/) {|s| s.downcase}
> end
>
> def windowControllerDidLoadNib(aController)
> super(aController)
> @root.model = @loadedmodel
> NSLog("model loaded")
> end
>
> end
>
> Regards,
>
> Tom Jordan
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] NSEvent MacRuby (updated)

2010-11-26 Thread Laurent Sansonetti
Hi Andras,

I think the problem is fixed in trunk, as r4952. Please give it a try or 
tonight's nightly build and let me know if it works for you. We don't test 
MacRuby very well for i386, this explains that the issue has not been found 
before.

Laurent

On Nov 25, 2010, at 3:57 AM, András Zalavári wrote:

> To fix it would be so nice, becouse it come out at so many places in my code, 
> that deals with the mouse. I have the same problem with getting the position 
> of a CALayer.  So it must be connected with CGPoint/NSPoint as Thibault sad
> 
> I send the bug on the tracker.
> 
> 
> Thans a lot!
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] windowControllerDidLoadNib strangeness

2010-11-26 Thread Tom Jordan
I'm having some trouble bringing in the old nib to the newly working
project,
so I went back to the old project and removed the MRGraphics code..
windowControllerDidLoadNib is now working right in the original project..
I hope there is a way to still use the MRGraphics library..
I'm going to submit an issue at its Github site..




On Fri, Nov 26, 2010 at 4:46 PM, Tom Jordan  wrote:

> Thanks Guys !  I just created a new project and it worked..  Now I'm going
> to bring in my files from the other project and see if I can find where it
> breaks..
> I'm also using the MRGraphics library at:
> https://github.com/mattetti/macruby_graphics
>
> It works great to quickly get a custom graphics view going, although I have
> noticed some strangeness with IB..
> in that whenever I add new widgets to the top level (and only) nib,
> I need to delete the custom view that has the MRgraphics, and repaste it
> back in, and reconnect it,
> or else the newly added widgets won't show up in the build (until you mouse
> over to where they're supposed to be and click..
> in which case they will appear (sometimes partially if it's a matrix, for
> example), and even then they won't function right).
>
> It drove me crazy until I found out that deleting the custom view and
> repasting it worked..  although I don't know what I'm going to do
> once I need to have more than one custom view and keep adding widgets,
> etc.. I just wanted to mention this in case
> anyone has seen this before.
>
> I'm running 10.6 on a Mac Pro.. which I believe it's 64-bit..
> I need to get a Github account or something so that I can post a full
> project if need be..
>
> This is a great resource, I appreciate the help.. thanks !
>
> Regards,
>
> Tom Jordan
>
>
>
>
> On Fri, Nov 26, 2010 at 3:42 PM, Laurent Sansonetti  > wrote:
>
>> Hi Tom,
>>
>> I just created a sample NSDocument-based project, and added
>> a windowControllerDidLoadNib: method to the NSDocument class, calling super
>> as you do, and everything worked as expected.
>>
>> Could you try that and see if you still see the problem? Also, do you run
>> a 32-bit machine?
>>
>> Laurent
>>
>>
>> On Nov 25, 2010, at 10:07 PM, Tom Jordan wrote:
>>
>> Hello,
>>
>> I'm encountering some weird behavior when trying to update a view using
>> When I provide windowControllerDidLoadNib a single argument, as shown
>> below (and required by the NSDocument class definition and in every example
>> I've seen),
>> Xcode says: `windowControllerDidLoadNib:': wrong number of arguments (1
>> for 0) (ArgumentError)
>> If I don't provide any argument, it says: undefined method
>> `windowControllerDidLoadNib' for # (NoMethodError)
>> I've tried every combination of one or no args for both the method
>> signature and "super" call on the next line, and I can't seem to get any
>> different results.
>> This is my first time trying to get persistence going, but I've read a lot
>> about it, and everything else is working well.. it saves and loads, but I
>> can't seem to get this hook
>> working to update the GUI upon loading.
>>
>>
>> class MyDocument < NSDocument
>>
>> attr_accessor :loadedmodel, :root #outlet to model field of controller
>>
>>  # Name of nib containing document window
>> def windowNibName
>> 'MyDocument'
>> end
>>
>> # Document data representation for saving (return NSData)
>> def dataOfType(type, error:outError)
>>  outError.assign(NSError.errorWithDomain(NSOSStatusErrorDomain, code:-4,
>> userInfo:nil))
>> NSKeyedArchiver.archivedDataWithRootObject(@root.model)
>>  end
>>
>> # Read document from data (return non-nil on success)
>> def readFromData(data, ofType:type, error:outError)
>>  outError.assign(NSError.errorWithDomain(NSOSStatusErrorDomain, code:-4,
>> userInfo:nil))
>> @loadedmodel = NSKeyedUnarchiver.unarchiveObjectWithData(data)
>>  end
>>
>> # Return lowercase 'untitled', to comply with HIG
>> def displayName
>> fileURL ? super : super.sub(/^[[:upper:]]/) {|s| s.downcase}
>>  end
>>
>> def windowControllerDidLoadNib(aController)
>> super(aController)
>> @root.model = @loadedmodel
>>  NSLog("model loaded")
>> end
>>
>> end
>>
>> Regards,
>>
>> Tom Jordan
>>
>> ___
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>>
>>
>> ___
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>>
>
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] windowControllerDidLoadNib strangeness

2010-11-26 Thread Tom Jordan
i jumped the gun...
The problem is in my code that uses the MRGraphics library..
since I removed that, but kept in all of the MRGraphics files, and required
it.
So they are compiling alright, but the







  def drawRect(rect)

@theSteps ? @theSteps : @theSteps = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16] # initial setup / default view values

@theStartstep ? @theStartstep : @theStartstep = 1

@theNumsteps ? @theNumsteps : @theNumsteps = 16

 dimensions = [CGRectGetWidth(rect), CGRectGetHeight(rect)]  #
MRGraphics setup code

Canvas.for_current_context(:size => dimensions) do |c|



stepboxes = Path.new # declare objects to be drawn

  highlightedRange = Path.new

  cursor = Path.new



  start = (@theStartstep-1)%16  # calculate highlighted range

  length = @theNumsteps

  if (start+length > 16)

highlightedRange.rect( start*29, 0, ((16-start)*29)+4, 162 )

highlightedRange.rect( 0, 0, (start+length-16)*29, 162 )

  else

highlightedRange.rect( start*29, 0, length*29, 162 )

  end



  cursor.rect( (start*29)-1, 0, 1, 162)  # calculate location of the
vertical cursor



  @theSteps.each_with_index do |k, i|   # calculate locations of the 16
step-boxes

stepboxes.rect( i*29, k*9, 29, 9 )

  end



  c.background(Color.gray) # paint background



  c.fill(Color.blue) # paint highlighted range

  c.draw(highlightedRange)



  c.fill(Color.yellow)  # draw step-boxes

  c.stroke(0)

  c.stroke_width(1)

  c.draw(stepboxes)



  c.fill(Color.black)  # draw cursor

  c.stroke_width(0)

  c.draw(cursor)



end

  end







On Fri, Nov 26, 2010 at 5:14 PM, Tom Jordan  wrote:

> I'm having some trouble bringing in the old nib to the newly working
> project,
> so I went back to the old project and removed the MRGraphics code..
> windowControllerDidLoadNib is now working right in the original project..
> I hope there is a way to still use the MRGraphics library..
> I'm going to submit an issue at its Github site..
>
>
>
>
> On Fri, Nov 26, 2010 at 4:46 PM, Tom Jordan  wrote:
>
>> Thanks Guys !  I just created a new project and it worked..  Now I'm going
>> to bring in my files from the other project and see if I can find where it
>> breaks..
>> I'm also using the MRGraphics library at:
>> https://github.com/mattetti/macruby_graphics
>>
>> It works great to quickly get a custom graphics view going, although I
>> have noticed some strangeness with IB..
>> in that whenever I add new widgets to the top level (and only) nib,
>> I need to delete the custom view that has the MRgraphics, and repaste it
>> back in, and reconnect it,
>> or else the newly added widgets won't show up in the build (until you
>> mouse over to where they're supposed to be and click..
>> in which case they will appear (sometimes partially if it's a matrix, for
>> example), and even then they won't function right).
>>
>> It drove me crazy until I found out that deleting the custom view and
>> repasting it worked..  although I don't know what I'm going to do
>> once I need to have more than one custom view and keep adding widgets,
>> etc.. I just wanted to mention this in case
>> anyone has seen this before.
>>
>> I'm running 10.6 on a Mac Pro.. which I believe it's 64-bit..
>> I need to get a Github account or something so that I can post a full
>> project if need be..
>>
>> This is a great resource, I appreciate the help.. thanks !
>>
>> Regards,
>>
>> Tom Jordan
>>
>>
>>
>>
>> On Fri, Nov 26, 2010 at 3:42 PM, Laurent Sansonetti <
>> [email protected]> wrote:
>>
>>> Hi Tom,
>>>
>>> I just created a sample NSDocument-based project, and added
>>> a windowControllerDidLoadNib: method to the NSDocument class, calling super
>>> as you do, and everything worked as expected.
>>>
>>> Could you try that and see if you still see the problem? Also, do you run
>>> a 32-bit machine?
>>>
>>> Laurent
>>>
>>>
>>> On Nov 25, 2010, at 10:07 PM, Tom Jordan wrote:
>>>
>>> Hello,
>>>
>>> I'm encountering some weird behavior when trying to update a view using
>>> When I provide windowControllerDidLoadNib a single argument, as shown
>>> below (and required by the NSDocument class definition and in every example
>>> I've seen),
>>> Xcode says: `windowControllerDidLoadNib:': wrong number of arguments (1
>>> for 0) (ArgumentError)
>>> If I don't provide any argument, it says: undefined method
>>> `windowControllerDidLoadNib' for # (NoMethodError)
>>> I've tried every combination of one or no args for both the method
>>> signature and "super" call on the next line, and I can't seem to get any
>>> different results.
>>> This is my first time trying to get persistence going, but I've read a
>>> lot about it, and everything else is working well.. it saves and loads, but
>>> I can't seem to get this hook
>>> working to update the GUI upon loading.
>>>
>>>
>>> class MyDocument < NSDocument
>>>
>>> attr_accessor :loadedmodel, :root #outlet to model field of contro

Re: [MacRuby-devel] windowControllerDidLoadNib strangeness

2010-11-26 Thread Tom Jordan
> The problem is in my code that uses the MRGraphics library..
> I removed that, but kept in all of the MRGraphics files, and required it,
> and windowControllerDidLoadNib is still working.
> So the MPGraphics files are compiling alright, but the code that uses it is
> somehow triggering an error.
>
   I'm just providing it here in case someone has used it before.
   I'm thinking that the problem is still with the graphics library,
   since I just copied one of their examples and changed it to use my
variables and objects to draw.

> Probably by calling into the library it somehow breaks
> windowControllerDidLoadNib
> although I did a search for windowControllerDidLoadNib in the MRgraphics
> folder and it's not there..
>

>
>   def drawRect(rect)
>
> @theSteps ? @theSteps : @theSteps = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
> 13, 14, 15, 16] # initial setup / default view values
>
> @theStartstep ? @theStartstep : @theStartstep = 1
>
> @theNumsteps ? @theNumsteps : @theNumsteps = 16
>
>  dimensions = [CGRectGetWidth(rect), CGRectGetHeight(rect)]  #
> MRGraphics setup code
>
> Canvas.for_current_context(:size => dimensions) do |c|
>
>
>
> stepboxes = Path.new # declare objects to be drawn
>
>   highlightedRange = Path.new
>
>   cursor = Path.new
>
>
>
>   start = (@theStartstep-1)%16  # calculate highlighted range
>
>   length = @theNumsteps
>
>   if (start+length > 16)
>
> highlightedRange.rect( start*29, 0, ((16-start)*29)+4, 162 )
>
> highlightedRange.rect( 0, 0, (start+length-16)*29, 162 )
>
>   else
>
> highlightedRange.rect( start*29, 0, length*29, 162 )
>
>   end
>
>
>
>   cursor.rect( (start*29)-1, 0, 1, 162)  # calculate location of the
> vertical cursor
>
>
>
>   @theSteps.each_with_index do |k, i|   # calculate locations of the
> 16 step-boxes
>
> stepboxes.rect( i*29, k*9, 29, 9 )
>
>   end
>
>
>
>   c.background(Color.gray) # paint background
>
>
>
>   c.fill(Color.blue) # paint highlighted range
>
>   c.draw(highlightedRange)
>
>
>
>   c.fill(Color.yellow)  # draw step-boxes
>
>   c.stroke(0)
>
>   c.stroke_width(1)
>
>   c.draw(stepboxes)
>
>
>
>   c.fill(Color.black)  # draw cursor
>
>   c.stroke_width(0)
>
>   c.draw(cursor)
>
>
>
> end
>
>   end
>
>
>
>
>
>
>
> On Fri, Nov 26, 2010 at 5:14 PM, Tom Jordan  wrote:
>
>> I'm having some trouble bringing in the old nib to the newly working
>> project,
>> so I went back to the old project and removed the MRGraphics code..
>> windowControllerDidLoadNib is now working right in the original project..
>> I hope there is a way to still use the MRGraphics library..
>> I'm going to submit an issue at its Github site..
>>
>>
>>
>>
>> On Fri, Nov 26, 2010 at 4:46 PM, Tom Jordan  wrote:
>>
>>> Thanks Guys !  I just created a new project and it worked..  Now I'm
>>> going to bring in my files from the other project and see if I can find
>>> where it breaks..
>>> I'm also using the MRGraphics library at:
>>> https://github.com/mattetti/macruby_graphics
>>>
>>> It works great to quickly get a custom graphics view going, although I
>>> have noticed some strangeness with IB..
>>> in that whenever I add new widgets to the top level (and only) nib,
>>> I need to delete the custom view that has the MRgraphics, and repaste it
>>> back in, and reconnect it,
>>> or else the newly added widgets won't show up in the build (until you
>>> mouse over to where they're supposed to be and click..
>>> in which case they will appear (sometimes partially if it's a matrix, for
>>> example), and even then they won't function right).
>>>
>>> It drove me crazy until I found out that deleting the custom view and
>>> repasting it worked..  although I don't know what I'm going to do
>>> once I need to have more than one custom view and keep adding widgets,
>>> etc.. I just wanted to mention this in case
>>> anyone has seen this before.
>>>
>>> I'm running 10.6 on a Mac Pro.. which I believe it's 64-bit..
>>> I need to get a Github account or something so that I can post a full
>>> project if need be..
>>>
>>> This is a great resource, I appreciate the help.. thanks !
>>>
>>> Regards,
>>>
>>> Tom Jordan
>>>
>>>
>>>
>>>
>>> On Fri, Nov 26, 2010 at 3:42 PM, Laurent Sansonetti <
>>> [email protected]> wrote:
>>>
 Hi Tom,

 I just created a sample NSDocument-based project, and added
 a windowControllerDidLoadNib: method to the NSDocument class, calling super
 as you do, and everything worked as expected.

 Could you try that and see if you still see the problem? Also, do you
 run a 32-bit machine?

 Laurent


 On Nov 25, 2010, at 10:07 PM, Tom Jordan wrote:

 Hello,

 I'm encountering some weird behavior when trying to update a view using

 When I provide windowControllerDidLoadNib a single argument, as shown
 below (and required by the NSDocument class definition and in every example
 I've seen),
 

Re: [MacRuby-devel] windowControllerDidLoadNib strangeness

2010-11-26 Thread Laurent Sansonetti
Hi Tom,

Could you try to reduce the problem into a new Xcode project? (adding 
MRGraphics to it if necessary.)

Once you have a reduction, please attach it to a new ticket: 
http://www.macruby.org/trac/newticket

Thanks :)

Laurent

On Nov 26, 2010, at 2:30 PM, Tom Jordan wrote:

> 
> The problem is in my code that uses the MRGraphics library..
> I removed that, but kept in all of the MRGraphics files, and required it, and 
> windowControllerDidLoadNib is still working.
> So the MPGraphics files are compiling alright, but the code that uses it is 
> somehow triggering an error.
>I'm just providing it here in case someone has used it before.
>I'm thinking that the problem is still with the graphics library,
>since I just copied one of their examples and changed it to use my 
> variables and objects to draw. 
> Probably by calling into the library it somehow breaks 
> windowControllerDidLoadNib
> although I did a search for windowControllerDidLoadNib in the MRgraphics 
> folder and it's not there.. 
> 
> 
>   def drawRect(rect)
>   @theSteps ? @theSteps : @theSteps = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 
> 12, 13, 14, 15, 16] # initial setup / default view values
>   @theStartstep ? @theStartstep : @theStartstep = 1
>   @theNumsteps ? @theNumsteps : @theNumsteps = 16
>   
> dimensions = [CGRectGetWidth(rect), CGRectGetHeight(rect)]  # MRGraphics 
> setup code
> Canvas.for_current_context(:size => dimensions) do |c|
>  
> stepboxes = Path.new # declare objects to be drawn
> highlightedRange = Path.new 
> cursor = Path.new 
> 
> start = (@theStartstep-1)%16  # calculate highlighted range
> length = @theNumsteps   
>   if (start+length > 16) 
> highlightedRange.rect( start*29, 0, ((16-start)*29)+4, 162 )
> highlightedRange.rect( 0, 0, (start+length-16)*29, 162 )
>   else 
> highlightedRange.rect( start*29, 0, length*29, 162 )
>   end
> 
> cursor.rect( (start*29)-1, 0, 1, 162)  # calculate location of the 
> vertical cursor
> 
>   @theSteps.each_with_index do |k, i|   # calculate locations of the 16 
> step-boxes
> stepboxes.rect( i*29, k*9, 29, 9 )
>   end
> 
> c.background(Color.gray) # paint background
> 
> c.fill(Color.blue)  # paint highlighted range
> c.draw(highlightedRange)
> 
> c.fill(Color.yellow)  # draw step-boxes
>   c.stroke(0)
>   c.stroke_width(1) 
> c.draw(stepboxes)
> 
> c.fill(Color.black)  # draw cursor
> c.stroke_width(0)
> c.draw(cursor)
> 
> end
>   end
> 
> 
> 
> 
> 
> 
> 
> On Fri, Nov 26, 2010 at 5:14 PM, Tom Jordan  wrote:
> I'm having some trouble bringing in the old nib to the newly working project, 
> so I went back to the old project and removed the MRGraphics code..
> windowControllerDidLoadNib is now working right in the original project..
> I hope there is a way to still use the MRGraphics library.. 
> I'm going to submit an issue at its Github site..
> 
> 
> 
> 
> On Fri, Nov 26, 2010 at 4:46 PM, Tom Jordan  wrote:
> Thanks Guys !  I just created a new project and it worked..  Now I'm going to 
> bring in my files from the other project and see if I can find where it 
> breaks..
> I'm also using the MRGraphics library at: 
> https://github.com/mattetti/macruby_graphics 
> 
> It works great to quickly get a custom graphics view going, although I have 
> noticed some strangeness with IB.. 
> in that whenever I add new widgets to the top level (and only) nib, 
> I need to delete the custom view that has the MRgraphics, and repaste it back 
> in, and reconnect it, 
> or else the newly added widgets won't show up in the build (until you mouse 
> over to where they're supposed to be and click.. 
> in which case they will appear (sometimes partially if it's a matrix, for 
> example), and even then they won't function right).
> 
> It drove me crazy until I found out that deleting the custom view and 
> repasting it worked..  although I don't know what I'm going to do
> once I need to have more than one custom view and keep adding widgets, etc.. 
> I just wanted to mention this in case
> anyone has seen this before.
> 
> I'm running 10.6 on a Mac Pro.. which I believe it's 64-bit..  
> I need to get a Github account or something so that I can post a full project 
> if need be..
> 
> This is a great resource, I appreciate the help.. thanks !
> 
> Regards,
> 
> Tom Jordan
> 
> 
> 
> 
> On Fri, Nov 26, 2010 at 3:42 PM, Laurent Sansonetti  
> wrote:
> Hi Tom,
> 
> I just created a sample NSDocument-based project, and added a 
> windowControllerDidLoadNib: method to the NSDocument class, calling super as 
> you do, and everything worked as expected.
> 
> Could you try that and see if you still see the problem? Also, do you run a 
> 32-bit machine?
> 
> Laurent 
> 
> 
> On Nov 25, 2010, at 10:0