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

2010-11-25 Thread András Zalavári
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] windowControllerDidLoadNib strangeness

2010-11-25 Thread Tom Jordan
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


Re: [MacRuby-devel] windowControllerDidLoadNib strangeness

2010-11-25 Thread Tom Jordan
trying to get the code to format right, here it is again (hopefully
better!):



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
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel