random-state.net

Nikodemus Siivola

<< next | top | previous >>

October 31st 2005 #
random, October 31st 2005

Hanna
 at Maria's and Teemu's wedding, Halloween 2005

Yesterday went to a friends' wedding with Hanna. Yum. More Halloween weddings! Very goth, very posh.

Borland Boggle

The moronisity of Delphi never ceases to amaze me. A TPageControl component is used to build tabbed notebooks. It has OnChanging and OnChange properties. The first is called whenever the active page is about to change and can prohibit the requested change. The second is called after the active page has changed. Pretty sane.

...except that there is no way to programmatically change the active page that would respect this protocol. What do these people smoke? I can understand having a way to bypass the protocol, but not having a way to programmatically manipulate a component with the same semantics that are used by GUI is bloody stupid.

I'm so missing CL's method-combinations. Now I had to write a separate ChangeTab thingamajik which re-implements the protocol. Not that this was hard or a lot of work — but it was very very wrong. The amount of work this represents is also not quite trivial, as the same symptom applies to other components as well.

I suspect that in the presence of method-combinations this atrocity would never have been perpetrated in the first place — and even if it had, I could have just used :around and :after methods without mucking about with the properties.

Of course, if I'm missing the obvious here, and there is a nicer way to change tabs, values in TDBLookupComboBox, etc programmatically — while respecting normal GUI semantics — please do tell. (I need this for UI testing code.)

Here's modest plea to all you toolkit writers out there: Make it easy to drive things programmatically, in a way that is indistinguishable from having genuine user poking around with a mouse. Apparently CLIM can do this to a degree:

<beach>	nikodemus: CLIM gadgets are exposed at various levels.
        You can call dispatch-event on them, or handle-event,
        or some other function that makes them do their thing.
        However, most of CLIM is not event driven, so you might
        have to wait for the command loop to pick up the event
        and do the right thing