On Sun, Jan 11, 2009 at 11:22 PM, François Vaux <[email protected]> wrote:
> 2009/1/12 Kevin Ball <[email protected]>: > > Hi Shoes hackers, > > > > After getting frustrated with the modify/save/reopen cycle to see how > > minor tweaks would look different in Shoes, I wrote a little shoes app to > > allow you to modify code & relaunch it all within a window of Shoes. > Anyone > > who wants to try it, its at > > http://github.com/kball/shoes-preview/tree/master. > > I've tried it an I actually like it, it's a great idea! > I'm working on a similar thing, in fact it will be a complete IDE for > beginners and it will allow the same feature of running the code from > the app. I haven't coded that feature yet, but I'm watching your app, > and maybe I could reuse the code for mine? :) (you can check out the > code at http://github.com/madx/solylace/ but it's rather crappy right > now :P) Cool, thanks! Absolutely you can reuse it. I'm happy that my tinkering can be of use. I was thinking on the train to work this morning about IDE-like features, I've now cloned solylace and am looking forward to playing with it on my ride home. > > > > 2) Is there an event that can be caught for a Shoes app closing? I > found > > that trying to close an app object that has already been closed causes a > > crash. > > I guess you ask this for removing the DemoApp from the list when it's > closed, but maybe you could just not use that class and eval the code > straight from the main app? And if the code contains Shoes.app, then > run it, else eval it in a new window ( window { eval @e.text } ) Mm, I like this idea, though I'm not sure if it will work if there are conflicts between e.g. keypress event handlers in the code and in the main preview application. I don't really have straight in my head the distinction between an app object vs a window, vs a flow really. They all have overlapping properties, but each has some slightly different details. Hopefully as I play with this more it will start to jell better. > > > > 3) Is there a way to catch ctrl/alt/etc keypress events inside of an > > edit_box? For example, if I hit ctrl-s in an edit_box, it doesn't add any > > text, and doesn't trigger the change event; is there an event it is > > triggering that I can catch somewhere? > > Maybe you could define your keypress events inside the top level > window, with the keypress method. This should work fine: > > def submit > @apps.push DemoApp.new(@e.text) > end > > @submit.click { submit } > > keypress do |k| > case k > when :control_s then submit > end > end If the edit_box is selected, the keypress events don't seem to make it up to this handler. I think this is because the edit_box is handling them itself and not passing them on. Trying @e.keypress do |k| #stuff end doesn't seem to work either though. -Kevin
