BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Throwing exceptions in wizards: good or bad?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OpenToolsAPI
View previous topic :: View next topic  
Author Message
Andrea Raimondi
Guest





PostPosted: Sun Feb 11, 2007 5:52 pm    Post subject: Throwing exceptions in wizards: good or bad? Reply with quote



Hello.

I have the need to abort a wizard if a project isn't selected.
My first attempt was to use MessageDlg but I receive an
exception when I try to use it.

This is my code:

procedure TReadMeWizard.Execute;
begin
if Not Assigned( FCurrentProject ) then
begin
MessageDlg( 'Can not start wizard. No project
assigned.',mtError,[mbOk],0 );
end;
// Stuff here
end;

Now I was thinking that throwing an exception may be a good
solution, but then I have to use MessageDlg in other
points too and I can't throw exceptions for confirmations and
other stuff like that. Maybe I should be using the output
window? I would rather use a custom dialog at this point.

Another option maybe is to have it enabled/disabled
according to the presence/absence of a selected project, but
would it work with the New dialog? I thought it would only
work with menu items but who knows...

Any thoughts?

Andrew
--
You can subscribe my blog at
http://www.andrearaimondi.net/rss.php or
http://www.andrearaimondi.net/atom.php
Back to top
Sergio Sette
Guest





PostPosted: Tue Feb 13, 2007 4:02 pm    Post subject: Re: Throwing exceptions in wizards: good or bad? Reply with quote



Quote:

Another option maybe is to have it enabled/disabled
according to the presence/absence of a selected project, but
would it work with the New dialog? I thought it would only
work with menu items but who knows...


Are you using D2006 ?
In D2006 your wizard can implement the IOTAFormWizard100 interface. (take a
look at the IsVisible function)

Ciao

sergio sette
Back to top
Erik Berry
Guest





PostPosted: Thu Feb 15, 2007 4:37 pm    Post subject: Re: Throwing exceptions in wizards: good or bad? Reply with quote



Andrea Raimondi wrote:
Quote:
I have the need to abort a wizard if a project isn't selected.
My first attempt was to use MessageDlg but I receive an
exception when I try to use it.

This sounds like a bug in the IDE. I'd put a simple test case in QC, and
maybe someone can them duplicate and promote it into the CodeGear internal
bug tracking system.

Erik
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OpenToolsAPI All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.