Just a heads-up for Borland C++ users: the C++ CodeRage 7 conference has had to be changed. It now runs from 10th to 12th December 2012.
This is the blog of Brian Long, Windows & mobile trainer, trouble-shooter and consultant.
Tuesday, 16 October 2012
Friday, 12 October 2012
CodeRage 7 registration open
Embo’s CodeRage 7 multi-day multi-product online conference is now open for registration! Follow this link to sign up for the Delphi and/or the C++ event – it’s totally free!
You can browse the sessions in the agenda for the Delphi event here and for the C++ event here and the list of speakers is also up online.
There’s oodles of good content there for Delphi and C++Builder developers and I’ll be giving an IDE productivity tips & techniques session to be screened in both the Delphi conference and the C++ conference.
I hope to “see you there”!
Wednesday, 10 October 2012
Embarcadero Developer Direct webinars return
After a good run of Developer Direct webinars over the summer, the Embo guys return with another ten 2 hour online sessions each Friday starting this coming Friday 12th October, 2012. The running times for the sessions are:
- 10:00-12:00 London
- 11:00-13:00 Frankfurt/Paris
- 13:00-15:00 Moscow
- 14:30-15:30 Mumbai/Bangalore
You can sign up to the series by using this link and that gets you access to any or all of the following sessions:
Episode | Date | Topic |
1 | 12 October 2012 | RAD Studio XE3 - The Story So Far! |
2 | 19 October 2012 | Be Agile Today! - Developer Workflow |
3 | 26 October 2012 | FM2 - FireMonkey in Action |
4 | 02 November 2012 | Language Focus (Object development, RTTI, 64 Bit) |
5 | 09 November 2012 | Mac Development for Windows Developers |
6 | 16 November 2012 | From Data to Business Information with RAD Studio XE3 |
7 | 23 November 2012 | Web and Mobile apps using HTML5 and CSS3 |
8 | 30 November 2012 | Multi-tier, Scalable Development and Deployment |
9 | 07 December 2012 | Windows 8 - Opportunities and Considerations for Developers |
10 | 14 December 2012 | Season Summary Session |
Tuesday, 2 October 2012
Windows tips
I like to consider myself reasonably competent in using Windows having picked up a whole bunch of tips, techniques and shortcuts over the many years (approximately 21) I’ve been using and programming against various versions of it.
For example, I’m one of a shrinking number of people who know that in a multi-selection list box with extended selection enabled (as opposed to a list view, just to be clear) you can press Shift+F8 to enter keyboard-driven multiple selection mode where Space toggles the selection of the current item and Shift+F8 or Esc leaves this selection mode. And I’ve know this since the days of Windows 3, before Raymond Chen made it more widely known in a 2006 post. Whilst on the subject of list boxes it’s also no longer well known that Ctrl+/ and Ctrl+\ perform select all items and select current item respectively.
However I’m always happy to pick up new tricks. I’ve bumped into a few recently and would like to share them with you.
A bounty of new XE3 videos coming
DavidI has kicked off a month of daily XE3 videos (that’ll be 31, then, what with this being October), all planned to be quick tips/demos less than 10 minutes long, more likely 5 minutes-ish.
The first one out yesterday was showing the Windows 8 styles that can be applied to VCL and FireMonkey applications in Delphi and C++Builder. There are form designer wizards that do this for VCL apps and for FireMonkey apps.
I’ll look forward to seeing more as the moth rolls on.
New compiler directives in Delphi XE3
There are a few changes/additions to the compiler in Delphi XE3. One of them is record helpers, much the same as class helpers but for records [UPDATE: actually the new thing about record helpers is mentioned a little further below]. This has been discussed and demonstrated on a few sites, such as Zarko Gajic’s delphi.about.com, Marco Cantù’s blog and Alister Christie’s LearnDelphi.tv.
These look quite interesting, but primarily from what Embo’s R&D will use them for rather than what you can use them for. I say this because the primary drawback of class or record helpers is that only one can be active on a class or record at a time, and it’s the last one found in scope.
Record helpers are poorly named really, as they can be used to add methods to primitive types [UPDATE: this is what is new in XE3 in relation to record helpers]. This is what TStringHelper does – it adds in a bunch of functions and properties to the basic string type, which incidentally are all 0-based in their behaviour, as opposed to regular string routines, which are all 1-based.
If you check in System.SysUtils.pas you will see that the way that these record helper methods manage to work zero-based is not by a lot of manual index offsetting in the code, but by a new and undocumented compiler directive that’s used around the implementation: {$ZEROBASEDSTRINGS ON}. [Edit: You can read more on this in Mark Edington’s October blog post].
Browsing through more of the XE3 source I noticed that the rules for $if have changed. All the cases of $if I bumped into are terminated by $endif, rather than $ifend as has previously been the case since its introduction in Delphi 6. A quick check shows that $if can now be closed with either $ifend or $endif. At the time of writing the documentation for $IF does not indicate this new flexibility so some investigation was required.
It turns out that there is another new (and currently undocumented) compiler directive that I was informed about, and then found had already cropped up in a discussion on the Embo fora. The directive is $LEGACYIFEND and the default state of this conditional is {$LEGACYIFEND OFF}. Using {$LEGACYIFEND ON} will take things back to how they were, forcing $IF to be closed by $IFEND and $IFDEF to be closed by $ENDIF.
If using the command-line compiler the --legacy-ifend command-line switch will also bring back the compiler behaviour of Delphi XE2 with regard to closing a $IF conditional compilation block.
So, to recap, this works in Delphi XE3 but does not compile in Delphi XE2 or earlier:
{$if defined(VER240)}
procedure foo;
begin
//blah blah
end;
{$endif}
but this throws up the same error in Delphi XE3 as it does in XE2:
{$ifdef CONDITIONALEXPRESSIONS}
{$if CompilerVersion >= 24.0}
{$LEGACYIFEND ON}
{$ifend}
{$endif}
{$if defined(VER240)}
procedure foo;
begin
//blah blah
end;
{$endif}
Oh, but talking of compiler directives something else cropped up. As is implied in the snippet just above Delphi XE3 adds in the new VER240 conditional define (there’s a list of these tucked away on this blog). This is present and correct in the compiler version table in Embo’s doc wiki, but hasn’t yet made it into the conditional defines page, though I’m sure that’s just a matter of time. However, the point I was getting round to is to emphasise something that can be found in a comment in the RTL’s System unit source code:
CompilerVersion is assigned a value by the compiler when the system unit is compiled. It indicates the revision level of the compiler features / language syntax, which may advance independently of the RTLVersion. CompilerVersion can be tested in $IF expressions and should be used instead of testing for the VERxxx conditional define. Always test for greater than or less than a known revision level. It's a bad idea to test for a specific revision level.
The code above therefore shows the approved way of checking for Delphi XE3 or higher, using CompilerVersion (see here for a list of these values), as well as the wrong way to check for Delphi XE3, using VER240.
Back to $IF/$ENDIF, it should be noted that ErrorInsight has not been updated to be aware of this new flexibility for $IF, so if you use the new pairing to set up a conditional compilation block it will flag up an error in ErrorInsight and give a red squiggle in the source editor. This has already been reported as a bug.
Monday, 1 October 2012
Embarcadero MVP Program officially up and running
After some weeks of being set up and readied the Embarcadero MVP program is now all official and public and the logos are done. You can visit the MVP landing page here to find out more about the program and see the full list of MVPs on the directory page here.
If you know of a helpful community member that does a lot for Delphi and isn’t in the MVP list then you can nominate them – for more info see the information page here.
I’m very pleased to be in the list from the beginning of the program.