Classes -- Project message boxes
Hi guys
I'm trying to improve my class-making skills... so humor me if you think this is the wrong approach. I have a project that uses several message boxes. Currently, i have these message boxes written into modules and have duplicate instances dotted around. What i want to do is write a class or set of classes that will make my project more efficients and easier to maintain - essentially one message box class (or set of classes) which would replace all my seperate module-level instances.
Ok so a typical message box comprises (excuse the terminology) the body of text, the title, the click type (ie OK, yes/no, etc), and the alert message (ie 'Warning!', 'Question', etc.).
Within my project, lets say i use the following text as the body:
"This is the end of the list"
"This is the start of the list"
i have the following titles:
"Ooops!"
"Argh!"
I use the following click types:
OK
Yes/No
And finally, the following alerts:
Warning!
Stop!
Could anyone give me an example of a class/classes that would alow me to call the desired message box from a module based on the combination in need?
Please give me a shout if i'm not making sense - any and all help appreciated.
Re: Classes -- Project message boxes
Not sure why this is necessary, unless I'm not getting the gist. Unless you're looking for the ability to name specific text boxes (text, title, and buttons) and call them using the name. Then it's a simple enum type passed into a function that does the proper call to MessageBox. I'm not seeing the need for a class at all, here... at most a single function Am I misunderstanding? Unless you want a class containing various functions, CallEndOfListTextbox(), CallStartofListTextbox(), CallADifferentTextbox(), CallAnotherDifferentTextBox(), and so forth. Yeah, you can do that, but I fail to see what it buys you over a simpler and more standard approach.
Re: Classes -- Project message boxes
This feels suspiciously like a homework definition? There happens to be a MessageBox class already defined. Perhaps you should look at it for inspiration?
Re: Classes -- Project message boxes
Quote:
Originally Posted by
HongKongCV
Not sure why this is necessary, unless I'm not getting the gist. Unless you're looking for the ability to name specific text boxes (text, title, and buttons) and call them using the name. Then it's a simple enum type passed into a function that does the proper call to MessageBox. I'm not seeing the need for a class at all, here... at most a single function Am I misunderstanding? Unless you want a class containing various functions, CallEndOfListTextbox(), CallStartofListTextbox(), CallADifferentTextbox(), CallAnotherDifferentTextBox(), and so forth. Yeah, you can do that, but I fail to see what it buys you over a simpler and more standard approach.
Like most of my questions... this is down to inexperience - so thanks for your input :). I'll look into using enums.
Re: Classes -- Project message boxes
Quote:
Originally Posted by
Sitten Spynne
This feels suspiciously like a homework definition? There happens to be a MessageBox class already defined. Perhaps you should look at it for inspiration?
Not very helpful... but thanks anyway.
Re: Classes -- Project message boxes
Quote:
Originally Posted by
GTDriver
Not very helpful... but thanks anyway.
Then be more specific? Did you take a good look? It's a class that seems to do everything you asked about, and if you piggyback its design you'd be close to implementing it yourself. What is lacking?