 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Andrea Raimondi Guest
|
Posted: Sun Feb 11, 2007 5:52 pm Post subject: Throwing exceptions in wizards: good or bad? |
|
|
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
|
Posted: Tue Feb 13, 2007 4:02 pm Post subject: Re: Throwing exceptions in wizards: good or bad? |
|
|
| 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
|
Posted: Thu Feb 15, 2007 4:37 pm Post subject: Re: Throwing exceptions in wizards: good or bad? |
|
|
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 |
|
 |
|
|
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
|
|