SyncEdit for implementation/interface member parameters

When I am editing a method (procedure/function) of an object, I sometimes need to add a parameter or change some. Now in Delphi code, as you probably know, you often have to do that twice: once in the implementation, and once in the interface of the unit (and make sure it matches…).

The Change Parameters dialog - do you ever use it? Too cumbersome imo.

Of course you can use the change params refactoring (Ctrl+Shift+X), but personally I find it too cumbersome to use the dialog to change something that could much easier be typed. And did you notice that your cursor has to be on the method name, not the parameters that follow it, for the refactoring to even be enabled? Blegh. It just breaks my ‘flow’… Lees meer over dit bericht

Advertenties

Respond to a click on the background of a listview

A typical list view, in this case from Explorer. Items are unselected when you click in an empty area.

I have a list view in a project that i use to show properties for objects in a tree-like hierarchy, much like the windows explorer. When a user clicks an item, its properties are shown. That wasn’t so hard, just handle the Click event.

When a user clicks next to an item or in an empty space of the list view, the item is automatically unselected in the view. The list view does this for you. I wanted to use this event, to show the properties of the parent object of the items in the view. But kind of to my surprise no Click event was fired when that happened.

In fact, I couldn’t find another event that really did what I wanted. Some suggested to use the ItemSelectionChanged event, like in this somewhat related problem, but that would require me to track all pairs of selection/unselection and to only respond when an item was unselected, after which no selected event would happen. I figured it would be too tricky (and too much work) to get that right.

So I cooked up another solution. It’s no rocket science, but it works exactly as I would like it to. Here’s how you do that… Lees meer over dit bericht