Another eventful day.
Progress today was great on the Ibex widgets, as I narrowed down a number of issues and put together some templates that effectively implement margin/pad from CSS (good for HTML devs learning Ibex quickly) and worked out how to play correctly with resources.
An Ibex resource:
.org.ibex.theme.win2k.image.bevel2up.nn
(which happens to point to the north image of the bevel2up border)
Obviously the border template has to be much more generic, so the idea was to pass it a resource. In the end, this turned out to be fairly simple [1]:
.org.ibex.theme.win2k.image["bevel" + thickness + form]
(which is passed to the border template as the base for a border)
Border then takes over:
border ++= function(v) { // 'cos border also has to accept strings if (typeof(v) == "object") { $nw.fill = v["nw"]; $nw.fill = v["nn"]; $nw.fill = v["ne"]; $nw.fill = v["ww"]; $nw.fill = v["ee"]; $nw.fill = v["sw"]; $nw.fill = v["ss"]; $nw.fill = v["se"]; }
Anyway, once that was established, progress was quite rapid and I probably managed to get 3-400 loc done in a few hours despite the girlfriend [2].
Note: the ++= syntax is for registering traps, which are a powerful form of event notification used in Ibex (something I haven't come across elsewhere). The above code is a write trap which is fired when the border property is put to. A read trap (fired on a read) is done the same way except without the argument for the function, ie function() instead of function(v). And you can register and unregister as many traps as you like on any property, so you can create a powerful cascade of traps for handling complex behaviour through just a single property.
Anyway, gotta end the blog before it becomes a lecture on Ibex... I'm just enjoying it, lots. Why else would I be up at 4am when I'm gonna be dragged out of bed in 5 hours time? XAML ain't seen us coming (despite a Microsoft employee being subscribed to our dev list)! ;-)
[1] The string-based method for manipulated resources is resource["subresource"], which allows for some really clever tricks (a topic for another time!) although it can get verbose for manipulating several levels. That requires nesting the square brackets (.res["sub"]["sub2"]["sub3"]) instead of using a string version of the dot-syntax (".res.sub.sub2.sub3") as I had been trying to do.
[2] She wonders why I frequently stay up til 2am or 3am (or 4am as it is tonight) just to struggle to wake up at 9... it's when I get the most peace and quiet as she's sleeping but I can't tell her that as I don't like to be on the receiving end of pain. Best to fool her into believeing I'm a geek! ;-)