Monthly Archives: March 2007

New CodeGear logo

 CodeGear has just gotten a new logo and I really like it, check it out:

CodeGear logo

It’s all part of a brand rollout you’ll be seeing more of. Internally, we’ve been provided with new letterhead styles, business cards etc. all very cool.

Ok, seriously, I’m going on vacation this last flurry of posts is what happens when I check my email before turning off the computer.

The new VCL property TApplication.MainFormOnTaskbar in Delphi 2007

In Delphi 2007, one of the changes we made in VCL was to provide better support for Window Vista, particularly in relation to window animations which occur when your application is minimized, restored or closed. Nathanial Woolls has a good write-up on some of the related issues.

Ok, I’d like to back up a little bit and explain why Delphi works this way in the first place. When Delphi first came out it used multiple free floating windows that all worked in concert with one another where the “main” window contained the menus and toolbars. When you minimized the main window the rest of the IDE’s windows disappeared and likewise when you restored they all came back. Well, that functionality doesn’t exactly come for free. There is a fair amount of code to try and make multi-window VCL applications behave like single window applications with regard to min/max/restore operations. Of course, this was well before Windows 95 and the taskbar which introduces additional complications.

The primary issue at hand is that the TApplication object has a hidden window used to deal with a lot of these operations although it wasn’t perfect either. In Delphi 2007, there is a new TApplication property called MainFormOnTaskbar that’s documented in the readme.txt (as it came in too late for formal documentation). The readme states:

“Delphi 2007 adds a new
property to TApplication called MainFormOnTaskBar. It
defaults to True for new Delphi 2007 applications and False for existing ones. The
property controls several aspects of how VCL applications perform with regard
to minimize/maximize/restore operations in Windows. Be aware that it will
affect the Z-order of your MainForm, in the event your applications depend on
the old behavior. MainFormOnTaskBar is intended to be set at startup and
persist throughout the duration of the application, changing this property at
runtime could result in unexpected behavior. The major reason for this change
was to better support several new features available on Windows Vista’s
Aero Theme. To update existing VCL applications, add the following line to the
project’s .dpr after “Application.Initialize;”:

Application.MainFormOnTaskbar := True;

Basically, what this property does is change the use of the TApplication hidden window and favor’s the MainForm’s window handle. This introduced a number of subtle changes like those mentioned above. Unfortunately, even prior to RTM we identified a few more issues and we’re actively investigating those now. I’ve seen a few posts on the public newsgroups like this and this which we are very much aware of. In the case of BDS 2006 minimizing the IDE should restore its taskbar button since Delphi 2007 replaces the VCL100.bpl package used by BDS 2006.

What you need to know
We’re working on identifying and fixing issues related to this property. In fact, Seppy has a spreadsheet that identifying 32 (at last count) scenarios and combinations thereof including things like MainFormOnTaskBar, ShowMainForm, programmatically setting Form.Visible, changing Visible in OnShow/OnCreate, changing Visible with a timer and Taskbar icons which we’ll continue to augment as we go. So, this isn’t the end of the MainFormOnTaskbar story.

Lastly, while this is a new property for Delphi 2007 it was added in a non-interface breaking manner just so we’re clear.

In case you missed, I’m currently on vacation and will follow-up next week.

Taking a bit of a break

Since I began hosting my own blog back in Oct ’06 I’ve posted 128 times over 168 days. I’m now taking a bit of a break after we’ve signed off Delphi 2007. In this past 168 days here are a few of the things that have happened:

I think that about sums it up. I’ve got two kids I’m now going to spoil the rest of this week. I’ve written one technical entry which I’ll post immediately following this one but that will be it until next week (aside from any guest appearances). Catch you next week!

Looking for advice on buying a bike

Lately, I’ve been considering buying a new bike that I could ride to work and I’ve been looking for recommendations and it suddenly dawned on me that this might be a good place to ask. I live roughly four, relatively flat, miles (6.5km) from my office here in Scotts Valley and I have an old dead $g(Diamondback bike) mountain bike I’m afraid to ride for fear of the rusted spokes killing me. I’d like to replace it with something similar but geared towards comfortable rode riding as I’d prefer not to arrive at work in a complete sweat. I heavily (pun intened) favor lifting weights to aerobic excersize and figure a bike would be a great way continue avoiding the treadmill. Lastly, I’d rather not spend a lot of money which I suppose is the real kicker. Does such a bike exist? If so, what would it be?

Oh, btw, I’m slighly over 6 feet (184cm) tall.

Thanks!

Google Reader currently wins over Bloglines for online aggregators in my book

Until January of this year I’d been using Bloglines as my feed aggregator and had been since 2004. I’ve now converted to Google Reader and haven’t looked back. I tried Reader when it first came out but it only took a minute or two to figure out it was no where close the functionality of Bloglines. All that changed when Google switched to the Gmail UI which is far more conducive to my style of blog reading as I tend to like to skim title’s quickly, one of many reasons I think title’s are important. Take these two screenshots:

 

I think that pretty much says it all. 

Reader also has better keyboard support and better UI in general. I’m glad I don’t work in the online aggregator business considering it’s so easy for customers to take their $g(OPML) and switch to a competitor. It took me two minutes to switch and 2 hours before I was comfortable enough to say goodbye to my old friend. I’ll probably watch to see if Bloglines can close the gap but right now it’s a pretty darn big.

Another cool feature of Reader is the Trends page (click on Home then “trends”). You can find things like your own personal reading habits and which feeds are frequently updated or not. I highly recommend it if you’re looking for an online aggregator.

Add or Remove Programs icon missing from the Windows Vista Control Panel?

In the control panel on Windows XP there was the trusty old “Add Remove Programs” icon where it was pretty darn obvious what that was going to do. Well, I’ve finally run into the need to uninstall a program from Windows Vista Ultimate. Now, I have the Control Panel set to “Display as menu” on the Start Menu but I don’t see “Add Remove Programs”. No problem, I right click and select “Open” to fire up Control Panel and there is no “Add Remove Programs” icon. Huh?

I click back to the Start menu and type “remove”, then “add programs”, then “uninstall” and nothing. Hmm, back to rooting around Control Panel. Now, admittedly I’d switched Control Panel to “Classic View” because as I was having a hard time finding things (!) So decided to click back to “Control Panel Home” which switches me back to the default Control Panel layout and I see this icon:

Ah ha! Ok, cool but where is that in “Classis View”? It appears with the same icon but titled “Programs and Features” with a hint of “Uninstall or change programs on your computer”. Not super intuitive but, ok.

Btw, here is a follow-up post that I wrote about all this which as some great comments…

Theming Windows applications in Delphi 2007

With the release of Delphi 2007 we’ve made it really simple to theme VCL applications using a checkbox option. On the Project Options dialog, on the Application page you’ll now see the “Enable runtime themes” checkbox which makes the necessary modifications to the projects (.res) resource file to ensure that your application is themed. By default, this option is checked for new Delphi VCL application and as I’ve indicated previously it controls how the designer renders your controls at design time.

Additionally, it’s no longer necessary to include either the TXPManifest component nor the XPMan unit (which is basically what dropping the TXPManifest component did) in your application. In fact, this method of theming your application will likely be deprecated in a future release of Delphi.

Be aware, theming your application may not be a quick and simple operation depending on the use of custom components that either you’ve written or are using. Not all components behave properly when themed so be sure to test your applications if you decide to check this option. You should also be aware of the performance impact that themes have on applications and test accordingly.

[UPDATED: Mar 21, 2007] Clarify that this option is check by default for new VCL applications. For existing applications you’ll need to set this manually. Add information about the resource that’s added to the .res file.

The resource that’s added to is called a “Manifest Resource” which you can learn more about here. Below is a copy of the manifest resource added to a new VCL project which, btw I highlighted using my online syntax highlighter.

1 <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 2 <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 3 <assemblyIdentity 4 type="win32" 5 name="CodeGear RAD Studio" 6 version="11.0.2597.23844" 7 processorArchitecture="*"/> 8 <dependency> 9 <dependentAssembly> 10 <assemblyIdentity 11 type="win32" 12 name="Microsoft.Windows.Common-Controls" 13 version="6.0.0.0" 14 publicKeyToken="6595b64144ccf1df" 15 language="*" 16 processorArchitecture="*"/> 17 </dependentAssembly> 18 </dependency> 19 </assembly>

Aligning, sizing and spacing commands in the Delphi 2007 VCL designer

Guest blogger: I’d like to introduce Jim Tierney, Principle Engineer working on the BDS development team at CodeGear as a guest blogger. Jim made numerous enhancments/improvements to the VCL form designer for Delphi 2007. I also work closely with Jim on the ASP.NET designer.

Prior to Delphi 2007, the “Align” and “Spacing” toolbars were not entirely supported by the VCL designer. Now, operations like “Align left edges” or “Increment horizontal spacing” can be performed by clicking a toolbar button. Delphi 2007 also makes it easier to identify and change the anchor component for these commands.

Align toolbar
The Align toolbar is an alternative to using the Edit|Align… and Edit|Size… commands. To show the Align toolbar, check “Align” on the toolbar popup menu.

The Align toolbar contains alignment commands as well as sizing commands like “Make same width”.  Note that most of these commands are grayed unless multiple components are selected.

The Align commands are: Align left, align right, align vert centers, align tops, align bottoms, align horz centers, align to grid, Snap to grid, make same height, make same width, make same size, size to grid

The Edit|Align… and…

Edit|Size… commands continue to work as in Delphi 2006.

Spacing commands
Spacing commands are new to the Delphi 2007 VCL designer (with the exception of “space equally”).  These commands change the spacing between components.  “Increment horizontal spacing” is an example of a spacing command.

To show the spacing toolbar, check “Spacing” on the toolbar popup menu.  Spacing commands are grayed unless multiple components are selected.


The Spacing commands are: space equally horz, increment horz spacing, decrement horz spacing, remove horz spacing, space equal vert, increment vert spacing, decrement vert spacing, remove vert spacing

Anchor element
When multiple components are selected, one component is the anchor.  When aligning, sizing, or spacing, the anchor component stays in place and the other component(s) are moved or sized in relation to the anchor.

There are two changes to anchor support in Delphi 2007.

  1. Clicking on a selected component makes that component the anchor.
  2. The handles of the anchor component are painted black. Other handles are gray.

In summary, these minor enhancements to the VCL form designer provide new and improved ways to position and size components.