Monday, September 29, 2008

Curl: what's in a name?

Actually I'm not going to carry on about Curl versus cURL today, but rather about what's optional in a Curl UI.

If you are running the Curl IDE and a Curl applet, you may not be aware that a CTRL-Right-Click gives you a popup from which you can inspect the Curl widget under your mouse pointer. So what's in a name?

Well, all Curl visual objects have options - and one option which you can set is a name. If you have a few applets sharing the same code packages, it can save you some time if you able to track that this widget 'X' in this container is in fact, say, 'the Demo-only custom drilldown label-only-hidden-button'.

Why does this matter? Well, if a widget container was instantiated declaratively, as say,
|| (somewhat simplified for illustration)
{MyContainer
{VBox {HBox {CustomWidget drilldown = anon-proc}}}}

you would have no handy instance variable (field) or local variable or getter method to access this instance of CustomWidget. Whether you are debugging production code or updating an iteration of a prototype, you may wish you had done this:
{MyContainer
{VBox {HBox {CustomWidget name="Demo drilldown here", drilldown = a-proc}}}}

Now when you use CTRL-R-Click to inspect that widget, you can flip open the options and there it is: the name. Want to set a breakpoint? Open the source file and search on that name. There you are.

So it's not so much "what's in a name" as "what useful tag is hidden in that widget ..."

No comments: