budgie
2006-09-12 14:34:09 UTC
One day, this will all be behind me and I'll look back ruefully at the hours
that I wasted on this b####y project ......
I have a form with four seperate control arrays of option buttons. The form is
used to (a) enable user configuration selection; (b) display a config determined
from a file; and (c) enable user editing of config ex a file.
The complicating factor is that the selections interact, and they have to. For
example, in the first array of two choices, selecting the second button is
required to invalidate the first and last selection in the second array (five
buttons). Any selection in the second array must invalidate at least one of the
four selections in the fourth array, which one depending on the selection in the
second array. Any selection (one of six) in the third array will dicate which
fourth array element is TRUE. So there are four Option_Click event routines
which ensure the logic is complied with.
(This isn't an exercise or a game, it is implementing a real world requirement.
All this interaction was quite *fun* to program, and works fine when I enter the
form for user data entry.)
However, when a configuration is determined from a file and I try to load this
information into the arrays for user view/edit, all hell breaks loose. My code
correctly determines which buttons are selected and disabled in each array. But
in setting values to TRUE in the decoding module, these _Click events are
triggered and it is like a cartoon ball ricocheting around a small room - there
are no less than TWELVE invocations of these _Click routines before a stable
configuration is achieved. And when the dust has settled, I see:
-> selection of disabled ("greyed out") options; and
-> invalid combinations
If I exit the form ("Cancel") and re-enter, the correct data* is shown. But
that is obviously not the way it ought to work.
If I re-order the blocks of code which determine and set TRUE the various array
options, the sequence of ball bounces (_Click event invocations) is different
but the overall result is the same.
If setting values to TRUE didn't trigger the _Click events, I'd he home and
hosed, but that's not how VB works. I've even tried using a Form_Load event to
effectively represent the secong call to the form, but can't make any headway.
Sorry for being so long-winded, but this one really has worn me to a frazzle.
I'd welcome any constructive suggestions. Please.
---------------------------------------------------------
* the third array data is ambiguous if determined from other arrays - either of
two values can match any selection in the other three arrays, but a selection in
this array has unique meaning and translates into a unique combination in the
other areas. So when the third array data is derived rather than user (or file)
selected, my code selects the lower of the two corresponding option indexes.
that I wasted on this b####y project ......
I have a form with four seperate control arrays of option buttons. The form is
used to (a) enable user configuration selection; (b) display a config determined
from a file; and (c) enable user editing of config ex a file.
The complicating factor is that the selections interact, and they have to. For
example, in the first array of two choices, selecting the second button is
required to invalidate the first and last selection in the second array (five
buttons). Any selection in the second array must invalidate at least one of the
four selections in the fourth array, which one depending on the selection in the
second array. Any selection (one of six) in the third array will dicate which
fourth array element is TRUE. So there are four Option_Click event routines
which ensure the logic is complied with.
(This isn't an exercise or a game, it is implementing a real world requirement.
All this interaction was quite *fun* to program, and works fine when I enter the
form for user data entry.)
However, when a configuration is determined from a file and I try to load this
information into the arrays for user view/edit, all hell breaks loose. My code
correctly determines which buttons are selected and disabled in each array. But
in setting values to TRUE in the decoding module, these _Click events are
triggered and it is like a cartoon ball ricocheting around a small room - there
are no less than TWELVE invocations of these _Click routines before a stable
configuration is achieved. And when the dust has settled, I see:
-> selection of disabled ("greyed out") options; and
-> invalid combinations
If I exit the form ("Cancel") and re-enter, the correct data* is shown. But
that is obviously not the way it ought to work.
If I re-order the blocks of code which determine and set TRUE the various array
options, the sequence of ball bounces (_Click event invocations) is different
but the overall result is the same.
If setting values to TRUE didn't trigger the _Click events, I'd he home and
hosed, but that's not how VB works. I've even tried using a Form_Load event to
effectively represent the secong call to the form, but can't make any headway.
Sorry for being so long-winded, but this one really has worn me to a frazzle.
I'd welcome any constructive suggestions. Please.
---------------------------------------------------------
* the third array data is ambiguous if determined from other arrays - either of
two values can match any selection in the other three arrays, but a selection in
this array has unique meaning and translates into a unique combination in the
other areas. So when the third array data is derived rather than user (or file)
selected, my code selects the lower of the two corresponding option indexes.