[MacRuby-devel] macruby/hotcocoa questions

Matthew Ratzloff matt at builtfromsource.com
Fri Feb 19 08:29:12 PST 2010


I'm jealous!  I can't really use HotCocoa at all because 32-bit support
isn't quite there yet (http://www.macruby.org/trac/ticket/415).  :-(

-Matt

On Thu, Feb 18, 2010 at 7:27 AM, Gary Weaver <gary.weaver at duke.edu> wrote:

> Hello,
>
> I wrote a small application in HotCocoa/MacRuby just to get familiar with
> it ( http://github.com/garysweaver/hourz ). MacRuby and HotCocoa are
> awesome! I did have a few issues during development that I thought I'd share
> in case anyone can assist.
>
> I'm using MacRuby 0.5 and HotCocoa 0.5.1 on OS X 10.6.2, was using TextMate
> vs. XCode to develop it. I have some experience with Ruby, but consider me a
> newbie to MacRuby, HotCocoa, and Cocoa (and Obj-C for that matter).
>
> Here is what I ran into:
>
> * If I take a stringValue from a text field, Marshal.dump it to a file, and
> then Marshal.load it, and put it back into the text field, it puts wierd
> characters in the end of the value like 'Òÿýÿÿÿ'. I think this might be a
> result of the class that I'm Marshalling that contains "include
> HotCocoa::Behaviors"? Not sure. I wasn't able to reproduce the issue via
> macirb using simple array or array of simple custom class Marshalling to
> file and back, but I'm able to reproduce the issue everytime in my app, but
> the class is more complicated.
>
> * I wasn't able to get File.copy to work so I wrote my own method to copy a
> file. Could you provide an example that can copy a file in MacRuby using
> File.copy or using FileUtils?
>
> * I wasn't able to set the (HotCocoa) layout_view frame or hidden
> properties successfully via calls by a button on_action. I could set them
> fine as long as they were called during startup of the application. For
> example, I wanted to do the following to hide a layout_view and replace it
> with another layout_view and vice versa in the same area of the window, but
> these methods only worked if being called during the initial load. I'm
> thinking maybe there is some sort of refresh method I need to call?
>
>  def in_add_mode
>   @edit_view.frame = [0, 0, 0, 0]
>   @edit_view.hidden = true
>   @add_view.frame = [0, 0, 0, 40]
>   @add_view.hidden = false
>  end
>
>  def in_edit_mode
>   @add_view.frame = [0, 0, 0, 0]
>   @add_view.hidden = true
>   @edit_view.frame = [0, 0, 0, 40]
>   @edit_view.hidden = false
>   # ...
>  end
>
> * (window).will_miniaturize { exit } works great to keep the app active (in
> the dock) after closing the window, but I don't know what to call such that
> I could close the window and then click on the icon in the dock it then show
> the window. Also when I close it, it doesn't appear to be in the hidden
> state, because the dock menu indicates that I can hide the window (but it is
> hidden).
>
> * I couldn't figure out how to access the dock_menu in HotCocoa/MacRuby
> (I'm not using XCode or
> http://www.echographia.com/blog/2009/02/08/dynamic-dock-menus-in-macruby/would have helped). I'd like to be able to manage it dynamically in HotCocoa
> if possible to be able to choose which Task I'm working on at the moment
> without showing the window. It would also be cool to dynamically change the
> dock icon when this happens to somehow indicate which task is being worked
> on (similar to Thunderbird showing the number of new messages, maybe I could
> show a number or some brief text?).
>
> * I couldn't figure out how to alter the "About" part of the application to
> provide the authorship, license, and link to the project, although I know
> the version number is specified in config/build.yml. It would also be cool
> to have full control over that area and define the window, etc.
>
> * I wasn't sure what the best practice would be to ensure that the window
> could be resized if someone somehow is using larger/smaller fonts, but to
> keep it from being resized so much that it is unusable. Maybe the right
> thing to do is to just specify a defined size/frame for the window that
> cannot be changed?
>
> * Note that I might also look into storing the task data as xml or json.
> I'd rather it be hand-editable if needed. (I assume I could just put the
> array into a hash and use to_xml/from_xml or to_json/from_json.)
>
> Again, thanks so much for all of your work on this. It is really cool to
> develop apps for OS X this quickly! (<16 hours total dev time, not including
> time to post to GitHub, and a lot of that was research, documentation,
> making an icon, etc.)
>
> Thanks in advance for any assistance!
>
> Gary
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20100219/1746589d/attachment.html>


More information about the MacRuby-devel mailing list