Re: Correct analysis of FAQ6.15?



Correction, Just in case someone actually ends up reading this.
On August 12, 2005 09:20 am, Bill Medland wrote:
Hi guys.

I am researching the whole field of data entry validation,
including in Gtk+.  I notice what is addressed in FAQ 6.15
(which I see in various forms around the Web) and a couple of
things popped out at me and I wanted to check that I do
understand the code properly.  (I'm still a beginner to Gtk+
so I feel unsure).  Please note that I am not criticising the
FAQ; I just want to know what it can and cannot do.

Basically what I see it doing is the following:
1. Take the input that is being passed in.  Remove or convert
any unacceptable characters and produce an equivalent but
acceptable input.
2. Temporarily disable the signal from the widget that is
being handled.
3. Insert the modified (now correct) input into the widget,
just as whatever is being handled did; but this time it won't
send the signal.
4. Reverse step 2;
5. Stop the signal propagating any further down the handler
chain.

Is that correct?

Not quite.  Step 2 only temporarily disconnects this handler, not 
the whole set of signal handlers.  So at step 3 the signal will 
be sent but the handler will not be called (but other handlers 
will)

So it seems to me that this solution is going to be a problem
if there are multiple signal handlers.
Yes
 If there is a handler
called before this one it will handle the invalid input and
won't get a chance to handle the "corrected" input.
No.  It will receive both the original and the corrected, even if 
the corrected is the same as the original.
 If there
is a handler after this one it won't get to handle any input.
No.  It will get to handle the corrected input during the second 
invocation.
Is that a valid observation?

Might this be a more robust (but still unstable) solution?
1. Look at the input.  If it is already acceptable then don't
do anything special.
2. If there is anything wrong with the input then create a
corrected copy, insert that (without disabling the signal) and
stop propagating the signal through its current chain.
with this handler temporarily disconnected.
(3. The corrected input will now come back into the top of the
chain, filter down and pass straight through this function).

Am I understanding it correctly?
No.  See comments above.
-- 
Bill Medland
mailto:billmedland mercuryspeed com
http://webhome.idirect.com/~kbmed




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]