Potentially Embarrassing Question Regarding Custom Controls

Started by Craig Scarborough, January 26, 2010, 06:17:14 PM

Previous topic - Next topic

Craig Scarborough

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

John Montenigro

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.

Paul Squires

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.


Paul Squires
PlanetSquires Software

Craig Scarborough

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!

Craig Scarborough

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.

Paul Squires

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.
Paul Squires
PlanetSquires Software

Rolf Brandt

That is a great sample, Paul.

You should put that into the Sample folder of FF3!
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Craig Scarborough