Re: Compound widget help [message #10861] |
Fri, 13 February 1998 00:00 |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Ed Meinel (meinel@aero.org) writes:
> OK, I've been thrashing around for a couple of days on this, and I'm hoping
> the local wise guys can give some help...
Heh, heh, heh. How much money have you got. :-)
> I am trying to build a compound widget which contains a group of non-exclusive
> buttons each with an associated editable text field. I've tried to hack
> together CW_FIELD and CW_BGROUP to get this effect, but I think I'm just
> sinking deeper into the muck and mire.
Since I've been ordered to keep my leg up and stay away from
my computer (at least when my wife is watching) for a few days, I've
taken Liam Gumley's good advice and curled up with Steve McConnell's
great book _Code Complete: A Practical Handbook of Software
Construction_. After reading a couple of chapters I can well
believe you are sinking deeper into the muck and mire.
Here is my advice. Forget about hacking CW_Field and CW_BGroup.
Those RSI-supplied routines are often written my people who
are great programmers, but poor teachers. :-) I find the code
a little dense, to be honest with you.
Why not start from scratch and write your own compound widget.
The kind of thing you want: a button next to a text widget
could not possibly take more than an hour or two to write.
A lot less time than it would take to understand *either*
CW_Field or CW_BGroup. Plus, you would have the added benefit
of knowing exactly how it worked.
I realize that you want a group of these things. But if you
write a single one as a compound widget, and you write it
correctly, then it is trivial to have a group of them in your
program. Believe me, the event handling will be a LOT simpler.
Compound widgets are very easy to build if you know how to
pass information around in "info" structures. Let me know if
you would like to have a simple example.
Cheers,
David
-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|