Tuesday, July 05, 2005

Winforms, One point!

Today I encountered an easy problem in a Winforms application. I had to set the default button for a form. I know this can hardly be called a problem. :-)

Let me see, in Delphi the TButton has a Default and Cancel property, set them and go. In winforms however buttons do not have that properties $-), well ahumm, after a bit of looking around I finally(yes I admit) found it!
In Winforms the form it self has an property AcceptButton and CancelButton, so you don't have to set a button property. Thinking it over the winforms solution is more logical compared to the VCL solution, where you can set multiple Default buttons for one form, which of course is looking for trouble.

Well I guess (finally) one point for Winforms.

2 comments:

ikari said...

Naaah, there has to be a trick! :)

Roland Beenhakker said...

Well, I could create an inherited button and add the properties Default and Cancel to be more VCL compatible.

Naah, just kidding :-)

Use an image as your UIBarButtonItem

Using an image as your UIBarButtonItem in your navigationcontroller bar can only be achieved by using a common UIButton as the BarButtonItem...