PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Craig Scarborough on January 26, 2010, 06:17:14 PM

Title: Potentially Embarrassing Question Regarding Custom Controls
Post by: Craig Scarborough on January 26, 2010, 06:17:14 PM
So anyway...been a long time programmer, but never ever delved into the area of creating any kind of control of my own (those standard Windows controls will be all I need, gosh darn it!).

So, I now find myself (I think) at a point where a custom control is going to be my saving grace.  I'm basically taking data and I want it to be outputted to a tabled format.  On top of that table will be more data - basically a series of labels and then a 6x 6 matrix with the custom data.  I now want to create a function that will output this formatted data, but this will have to be done on multiple forms so I need to standardize my function so I can output this data on multiple forms and potentially more than one on a single form.

My questions are as follows:

1) I'm assuming this is an ideal situation for a custom control, correct?  The control itself will have very little interaction (if any).  It will basically be a static "card" of data.

2) My custom control will be a series of labels and then a matrix of labels to create a 6 x 6 matrix - I would assume that's extremely "do-able" and borderline simple, correct?

3) Where the heck can I find a tutorial either in FF3-land (I've been using the search utility but haven't found anything yet) or something that is immediately compatible with FF3?

Thanks much for any help - I realize I'm extremely behind the times and I probably should know this stuff already.

-Craig
Title: Re: Potentially Embarrassing Question Regarding Custom Controls
Post by: John Montenigro on January 26, 2010, 08:28:59 PM
Don't "should" on yourself!

I've been a hobbyst programmer since ~1980 (with one more or less professional gig in between), and I'm looking forward to seeing the answers to your question because I don't have a clue!

Lots of people become proficient in one area or another, and are raw novices in others.

There is no "rule" other than stay curious and ask questions.

-JohnM.
Title: Re: Potentially Embarrassing Question Regarding Custom Controls
Post by: Paul Squires on January 26, 2010, 10:10:59 PM
Off the top of my head, I doubt that this needs to be a custom control (although it could be). You could create your "control" on a standard FF form and set that Form's styles such that it does not have a caption or sysmenu, etc... Basically, set it to be a TabControlChild type of form. Set the WindowStyle of the Form to be WS_CHILD.

When you need to use the "control", load the form modeless and then position and display it on the form that you need the control displayed on. Basically your "control" is a child form of the main form. Similar to the way that tab control child pages work.

I don't have an example of this offhand but I think this should be very easy to do and would only involve designing your form from within FireFly. No complex code needed.


Title: Re: Potentially Embarrassing Question Regarding Custom Controls
Post by: Craig Scarborough on January 27, 2010, 12:30:33 AM
Wow - I didn't even realize that was possible!  Could I make a control array of child forms like this so I can write to more than one child form on a single parent form?   Do I have to convert my application to an MDI app?

Thanks!
Title: Re: Potentially Embarrassing Question Regarding Custom Controls
Post by: Craig Scarborough on January 27, 2010, 02:34:45 AM
Quote from: John Montenigro on January 26, 2010, 08:28:59 PM
Don't "should" on yourself!

I've been a hobbyst programmer since ~1980 (with one more or less professional gig in between), and I'm looking forward to seeing the answers to your question because I don't have a clue!

Lots of people become proficient in one area or another, and are raw novices in others.

There is no "rule" other than stay curious and ask questions.

-JohnM.

Thanks, John!  Sometimes, after reading these and especially the PB forums, I realize how little I really know about Windows programming and I get a little gun-shy.
Title: Re: Potentially Embarrassing Question Regarding Custom Controls
Post by: Paul Squires on January 27, 2010, 08:53:41 AM
I put together a little example program to show you just how powerful this technique is. You can create controls for yourself pretty easily using child forms.

Check out the attached project.
Title: Re: Potentially Embarrassing Question Regarding Custom Controls
Post by: Rolf Brandt on January 27, 2010, 10:31:12 AM
That is a great sample, Paul.

You should put that into the Sample folder of FF3!
Title: Re: Potentially Embarrassing Question Regarding Custom Controls
Post by: Craig Scarborough on January 27, 2010, 01:57:24 PM
Awesome - thanks Paul!  Just what I needed!