Re: [MacRuby-devel] What's the best way to implement a delegate/action with multiple parameters?

2008-11-21 Thread Benjamin Stiglitz
I'm pretty new to Cocoa, so maybe I'm overlooking the obvious here.   
I just want to make sure I'm not doing more work than necessary.


I'd like to be able to control the minimum size for a NSSplitView.   
As I understand it, I need to have a delegate with a method that can  
handle

splitView:constrainMaxCoordinate:ofSubviewAt:

So far that isn't supported using Interface Builder, is it?

If I need to do it 'manually'  - do I get a reference to the  
NSSplitView, and then tell it to set its delegate to something that  
responds to the method?  When/where should I do this - in the Window  
Controller's AwakeFromNib or some other place?


You can set the delegate in Interface Builder by ctrl-clicking from  
the split view to the delegate object and clicking “delegate” in the  
resulting HUD popup. Then just implement that method on your delegate  
object.


If you haven’t already, be sure to check out the Delegates and Data  
Sources guide at:



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


[MacRuby-devel] PBI - HTML and CSS in HotCocoa

2008-11-21 Thread Rich Morin
It's possible to use HotCocoa to lay out windows, but (AFAIK)
the developer still has to do most of the layout, specifying
co-ordinates, etc.

Like lots of other Ruby developers, I'm comfortable with HTML
and CSS layout.  So, I wonder how hard it would be to convince
WebApp (for example) to accept web layout commands and hand
back the resulting co-ordinates.  Some kind of AJAX hack could
even be used, I suspect, to get dynamic JavaScript support.

I'd love to hear about any show-stoppers, other ideas, etc.  I
would be even happier to get some implementation hints (:-).

-r
-- 
http://www.cfcl.com/rdmRich Morin
http://www.cfcl.com/rdm/resume [EMAIL PROTECTED]
http://www.cfcl.com/rdm/weblog +1 650-873-7841

Technical editing and writing, programming, and web development
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] PBI - HTML and CSS in HotCocoa

2008-11-21 Thread elliottcable

This sounds like an idea with potential.

Perhaps a new framework for creating "HTML" applications, that takes  
the HTML and uses a WebView - but instead of actually ending up with a  
WebView, the data is pulled out and passed onto a true Cocoa  
interface, kinda thing?


On Nov 21, 2008, at 11:25 AM, Rich Morin wrote:


It's possible to use HotCocoa to lay out windows, but (AFAIK)
the developer still has to do most of the layout, specifying
co-ordinates, etc.

Like lots of other Ruby developers, I'm comfortable with HTML
and CSS layout.  So, I wonder how hard it would be to convince
WebApp (for example) to accept web layout commands and hand
back the resulting co-ordinates.  Some kind of AJAX hack could
even be used, I suspect, to get dynamic JavaScript support.

I'd love to hear about any show-stoppers, other ideas, etc.  I
would be even happier to get some implementation hints (:-).

-r
--
http://www.cfcl.com/rdmRich Morin
http://www.cfcl.com/rdm/resume [EMAIL PROTECTED]
http://www.cfcl.com/rdm/weblog +1 650-873-7841

Technical editing and writing, programming, and web development
___
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] PBI - HTML and CSS in HotCocoa

2008-11-21 Thread Rich Morin
At 12:52 -0900 11/21/08, elliottcable wrote:
> This sounds like an idea with potential.
>
> Perhaps a new framework for creating "HTML" applications, that takes
> the HTML and uses a WebView - but instead of actually ending up with
> a WebView, the data is pulled out and passed onto a true Cocoa
> interface, kinda thing?

Pretty much.  For example, imagine that WebApp hands back a DOM tree
that is decorated with geometric information.  The MacRuby app walks
this tree and makes the appropriate HotCocoa calls.

I think WebApp will simply pass through information it doesn't need,
so it should be possible to send in (say) a div that has attributes
for widget type (etc) and get back something that means "put one of
these widgets in this location with this size".

I'm quite sure there are some ugly details to work out, but it costs
us nothing to speculate about desirable behavior (:-).

-r
-- 
http://www.cfcl.com/rdmRich Morin
http://www.cfcl.com/rdm/resume [EMAIL PROTECTED]
http://www.cfcl.com/rdm/weblog +1 650-873-7841

Technical editing and writing, programming, and web development
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] Bindings only working one-way

2008-11-21 Thread Michael Winterstein
I'm having difficulty working with bindings and I'm not sure if it's a  
MacRuby thing or my poor understanding of how they work.


I've tried binding to two types of things - an NSMatrix of radio  
buttons (binding to "selectedTag") and a Checkbox value.


Using just an attr_accessor - the variable changes when the user  
changes them, but changing the variable doesn't update in the UI.


So I added an explicit setter method and to change the variable, I use  
self.setVideoSource(VID_USE_S2) to modify it.


This works to change it on-screen, but now UI changes aren't getting  
through to the variables properly.  The NSMatrix variable isn't  
changing, and the other variables are changing but are no longer  
Boolean.  (If I do a "p x" I get  either # or  
#.


I tried replacing 'attr_accessor' with 'attr_reader', and adding an  
explicit getter. That results in the following when I run (even if I  
add a 'return nil' to my setter method):


[4169:10b] KVO autonotifying only supports -set: methods that  
return void. Autonotifying will not be done for invocations of - 
[MainWinController setVideoSource:].


I haven't yet tried manual notification because I'm not likely to use  
bindings for this case if that much work is required.  Is this the  
expected way to go, or am I missing something here?




Here's a bit of the code (these are set as keys in IB).  When used  
elsewhere, I just have them as the instance variable :


attr_accessor   :audioIncludeS1 # whether to include audio
attr_accessor   :audioIncludeS2 # for a particular channel
attr_accessor   :videoSource# which source to use (if any) 
for video

def setAudioIncludeS1(value)
@audioIncludeS1 = value
end

def setAudioIncludeS2(value)
@audioIncludeS2 = value
end


def setVideoSource(value)
case value
when VID_USE_S1
@videoSource = VID_USE_S1
when VID_USE_S2
@videoSource = VID_USE_S2
when VID_USE_NONE
@videoSource = VID_USE_NONE
else
@videoSource = VID_USE_NONE
end
end

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