
The Import Component Wizard supports copy (CTRL + C). If I press CTRL + C on the dialog above I get "Active Setup Control Library, Version 1.0, C:\WINDOWS\SysWOW64\asctrls.ocx" in my clipboard buffer. Kinda handy.
Tuesday, April 15, 2008
Delphi Tips and Tricks: Import Component Wizard
Posted by
Chris Bensen
at
4:00 PM
2
comments
Labels: C++Builder, Delphi
Friday, April 11, 2008
Writing a Delphi Menu Item Plugin
Trying to figure out the Delphi Open Tools API can be a daunting task. Here is a bit of code to get a menu item into the Delphi IDE's main menu. Please note that I didn't test this code and you will want to reorganize it a bit.
unit ComStdReg;
interface
uses Menus, ActnList;
type
TMyMenus = class
private
FMenuItem: TMenuItem;
FMenuAction: TAction;
procedure DoExecute(Sender: TObject);
procedure DoUpdate(Sender: TObject);
public
constructor Create;
destructor Destroy; override;
end;
implementation
uses ToolsAPI;
constructor TMyMenus.Create;
var
MenuService: INTAServices;
begin
MenuService := BorlandIDEServices as INTAServices;
if MenuService <> nil then
begin
MenuItem := TMenuItem.Create(nil);
MenuAction := TAction.Create(nil);
MenuItem.Action := MenuAction;
MenuItem.Name := 'MyMenuItem';
MenuActiond.Caption := 'My Menu Item';
MenuAction.OnExecute := DoExecute;
MenuAction.OnUpdate := DoUpdate;
MenuAction.Enabled := False;
// Only set this if you want to allow F1 when the mouse if over the menu item.
MenuAction.HelpContext := 0;
// Tell the menu service which item to place your menu item after. This will
// place your menu item after Component | Installed Packages.
MenuService.AddActionMenu('ComponentPaletteItem', MenuAction,
MenuAction);
MenuService.UpdateMenuAccelerators(MenuService.MainMenu);
end;
end;
destructor TComMenus.Destroy;
begin
FMenutItem.Free;
FMenuAction.Free;
inherited;
end;
procedure TComMenus.DoExecute(Sender: TObject);
begin
// DoExecute is called when the the menu item is clicked.
end;
procedure TMyMenus.DoUpdate(Sender: TObject);
begin
// DoUpdate is called when the menu is displayed.
// Here you will want to set FMenuAction.Enabled to True or False or
// FMenuAction.Visible to True or False. I personally don't like it when menu
// items hide so don't change visible.
end;
Posted by
Chris Bensen
at
7:30 AM
7
comments
Labels: C++Builder, Delphi
Wednesday, April 9, 2008
Going Green
Green is all the rage lately, and I'm all in favor of it for many reasons. I figured a green post was worthy since Earth Day is coming up. Lately it's been hard to go a few days without hearing about someone's carbon footprint and at 6'5" I have a pretty large carbon footprint. Seriously, I eat a lot of food.
One of my favorite reasons to have an environment around is so everyone I know, including myself, can live. My second favorite reason is so I can take photos like the one at the top of this post. I figured a photo of Mono Lake would be fitting for an environmental post such as this. Also pretty. I just got done editing it from a trip my dad and I made to the Sierras in October of 2005.
One of the things that bothers me about all the green talk is people and companies can buy down their "carbon footprint" with energy credits. I hear that Al Gore does this. It seems pretty silly since circulating more money inherently means growing the economy which is causing the environmental problems in the first place. Anyway, I'm digressing and I'm sure many people will have a comment or two about that.
Some companies like Patagonia go to great lengths to determine their impact on the planet with their Footprint Chronicles. I also think every company should join 1% For the Planet. There's also Google's Solar Panel Project. And you've probably seen Blackle where it is claimed that if Google were to change the default background color from white to black they'd save people from using loads of energy.
I've reduced the number of computers I use at CodeGear from three to two and they are set to wake-on-LAN so I can remote desktop into them. Somehow it doesn't seem even close to any of the projects I listed above but every little bit counts. Of course I do other things like recycle, drive as little as I can, ride my bike when I can, turn off lights etc. I probably could save some of you energy by optimizing the amount of memory that Delphi uses or something. Delphi already has the Twilight color scheme so I can't improve that.
And if it weren't difficult enough some things that are supposedly good for the environement really aren't. Time magazine has an article about ethanol and how is disastrous for the environment. Who really knows, but I do know I was thinking similar things when bio diesel became all the rage.
http://www.time.com/time/magazine/article/0,9171,1725975,00.html
Last week I dug a big hole for a tree in the front yard and I ran across a piece of styrofoam that was put into the ground over 10 years ago when the house was built. Needless to say it was a little dirty on the outside, but it was perfect on the inside. Nice! Good thing nearly everything comes packaged up in the stuff. I guess just buying less stuff will have an impact. But my government wants me to spend my tax credit. Hmmmm...
Of course one of the problems with computers and electronics is they are by their very nature tough on the environment. I've been trying to do business with environmentally friendly companies when possible. I try and look for companies that actually use less or have solar panels or just something that is actually energy efficient and not wasteful. Maybe they recycle for instance. A perfect example is aiso.net which is a web hosting company that I've been considering switching to. Has anyone had any experience with them? I'm looking for more companies that think like the ones I've listed here so I can do business with them.
What sorts of things have you or your company done to be more green?
Posted by
Chris Bensen
at
12:00 PM
5
comments
Labels: photo
Tuesday, March 25, 2008
Hey Dude, Nice Function Name
I'm just as guilty as the next programmer. Going through some code I wrote a few releases back in a bit of a rush and here's a nice little function:
procedure FixStuff(const Project: IProject; const FileName, CoClassName: string);
Nice!
I think I'll at least rename it to FixComStuff. Fortunately FixStuff doesn't even compete with DoThings. Too bad there wasn't a comment:
{ Don't know why this works. Don't touch it }.
Posted by
Chris Bensen
at
10:00 AM
2
comments
Buying a Mac
Everyone seems to be looking at buying a Mac lately. Well either that or they hate em'. Even Allen Bauer picked one up. He walked into my office about a month ago with a big grin on his face and said "I did it!"
Like many of you I'm tech support for my entire family, friends, extended friends, friends of family and friends of friends. Recently many of them have been upgrading their computers. My old hand-me-downs are starting to get pretty darn old I guess. My dad, for example, just bought the low end iMac. He went back and forth between Dell and Mac more times than I can count but once his best friend showed him his iMac my dad was almost sold. I say almost because it still took a few months, many trips to the Apple store and lots of reading before he made the plunge. Now he's up late at night video chatting with friends on the other side of the globe and his only regret is that he didn't buy it sooner.
One of my Dad's biggest problems was moving to the Mac is the lack of Quicken. Sure there is a Quicken-like piece of software sold called Quicken, but it leaves much to be desired. Even QuickBooks isn't as good as the Windows version. I've been using QuickBooks and iBank for a while now and they work but they arn't that good. I think the reason there isn't better personal finance software out there (even for Windows) is because nobody does it. They all do it online (which really isn't personal finance in most cases) or they just don't balance their checkbook. Makes me wonder.
Oh, and to answer Allen's burning question as to why Macs are so entrenched in school; they aren't. In the graphics professions the reason they have standardized on the Mac platform is because the fonts are completely different on Windows and Mac and the Mac works better, and in some cases they are just used to the Mac. I realized this when the Missus did work at home on our Windows version of Illustrator and brought it to her Mac at work and had to change out each font and adjust the location for it to look right. Mac renders the display to look as it will print. Windows renders the display as it will look on the monitor. Make a long story short, they look different.
I personally like Mac at home because I work all day with Windows and when I use a computer on my personal time I don't want it to be work. Also the color profiling is awesome on the Mac and I really like the hardware.
Posted by
Chris Bensen
at
6:00 AM
2
comments
Friday, March 21, 2008
Easter
When I found out Easter was so early I thought "isn't this an April holiday?" Then I remembered it was some crazy full moon after the equinox thing. Here's wikipedia's description of when Easter is:
"...Easter is the first Sunday after the first fourteenth day of the moon (the Paschal Full Moon) that is on or after the ecclesiastical vernal equinox."
I'd sure hate to calculate Easter programatically but here's a link to a simple Delphi function to calculate it:
http://delphi.about.com/cs/adptips2002/a/bltip0302_2.htm
Posted by
Chris Bensen
at
8:30 PM
2
comments
The Comment You Don't Want to See
Have you ever been looking through some code trying to figure out what it does and see something like this:
{ this is a bit of a hack }
This is (one of) the most unhelpful comments a person could write. Please don't do things like this in your code. Just describe why it's a hack and describe what should be done.
Posted by
Chris Bensen
at
1:00 PM
4
comments
Thursday, March 20, 2008
Where's Chris?
I've received some emails asking if I was still alive on the account that I haven't blogged much over the last few months. Yes, I'm still alive thank you for your concern. With it being tax season, my daughter getting 8 teeth over the last month hence no sleep, and various other events, things have just gotten rather busy. I have written up a few posts but unfortunately they can't be published until after Tiburon is released.
As you've probably noticed I haven't updated the photo of the month in a while either and that's because I haven't been doing any wildlife or nature photography lately. But you can see one of my photos in the Spring issue of Nature Photographer which is currently in stores.
When adding this photo to this post I was just reminded of why I post my photos so small. Many people have asked for me to post them larger and the simple reason I don't post them larger is they get stolen.
Posted by
Chris Bensen
at
8:10 AM
6
comments
Monday, March 3, 2008
CodeGear COM Contractor Needed
There is a job opening for a COM QA contractor available at CodeGear working on Delphi and C++. If you are interested contact me and I'll forward your information to the hiring manager.
Posted by
Chris Bensen
at
11:30 AM
3
comments
Thursday, February 14, 2008
Monday, February 4, 2008
February Photo of the Month
This photo was taken this winter in Tahoe during a break in the last big storm we had.
Posted by
Chris Bensen
at
8:00 AM
0
comments
Labels: photo
Friday, February 1, 2008
CodeGear™ Software Development Tools To Be Installed on up to 1 Million PC’s in Russian School System
The press release just went out, "Russian Federal Agency of Education Standardizes on CodeGear Products for Teaching Software Programming". Here is an InfoWorld article.
Posted by
Chris Bensen
at
8:00 AM
0
comments


