RE: [Win32Lib] Best way to get data from input controls

new topic     » goto parent     » topic index » view thread      » older message » newer message

Thanks, Derek!

That's more of the explanation I was hoping for.  Now it makes sense! :)

Andrew Hall

-----Original Message-----
From: Derek Parnell [mailto:ddparnell at bigpond.com] 
Subject: Re: [Win32Lib] Best way to get data from input controls



----- Original Message ----- 
From: "A. Hall" <cheetah_heels at myrealbox.com>
To: <EUforum at topica.com>
Sent: Saturday, November 22, 2003 7:33 PM
Subject: RE: [Win32Lib] Best way to get data from input controls


> 
> 
> Dan,
> 
> Good point - it's definitely easier to code.  For this reason, I would
guess
> that this is the method most people use.
> 
> Win32Lib users: Is this how everyone normally gets input data?
> 
> Andrew Hall
> 
> -----Original Message-----
> From: Dan Moyer [mailto:DANIELMOYER at prodigy.net] 
> Sent: Friday, November 21, 2003 11:27 PM
> To: EUforum at topica.com
> Subject: Re: [Win32Lib] Best way to get data from input controls
> 
> 
> Andrew,
> 
> I'm no expert, but I would think your second method, (get all option info
on
> press OK),  is probably preferable, since you're not going to *use* the
info
> until the OK button is pressed, and it probably won't take but a 1/10
second
> or less to get all the data, and you will only have to write one event
> handler.
> 
> Dan Moyer
> 
> ----- Original Message ----- 
> From: "A. Hall" <cheetah_heels at myrealbox.com>
> To: <EUforum at topica.com>
> Sent: Friday, November 21, 2003 10:56 PM
> Subject: [Win32Lib] Best way to get data from input controls
> 
> 
> > Hi,
> >
> >   Suppose I have a window with several checkboxes, radio buttons, and
> > text fields.  There is an OK button that uses the options specified by
> > these controls to perform a task (as in any Windows app).  A Euphoria
> > variable is set up for each control to hold its value in case the value
> > happens to be used more than once while the task is performed.  What is
> > the most efficient way to get data from these controls when the OK
> > button is pressed?  From my perspective, there are two possibilities:
> >
> > 1. On every Change event, assign the new value of the control to that
> > control's variable.  When the OK button is pressed, all the values are
> > already stored and immediately available for execution of the task.
> >
> > 2. Don't do anything until the OK button is pressed.  When it is
> > pressed, successively get each control's value and store it in that
> > control's variable.  Then proceed with the execution of the task.
> >
> >   Between these two options, which is the most efficient?  Which is used
> > more often?  Is there another method?  (Is this such a beginner's
> > question that the answer should be obvious?)
> >

Andrew,
this issue is not a win32lib-only issue. It applies to any GUI application. 

In broad terms, the only reasons to fetch data on a Change event is when the
current content effects other controls/variables in real time, and when it
is absolutely essential that the control's data is valid BEFORE the user
leaves the control (changes focus). The first reason is fairly common but
the second is fairly rare.

The usual situation is that the data in controls is only needed (to be
validated and/or used) at specific events - such as the user pressing OK or
Cancel or the like.

It is nearly ALWAYS better to validate the control's data after the user has
pressed OK than on a field-by-field basis as this gives the user control
over the program rather the other way round. For example, it lets the user
enter data in an order that makes sense to them, and it allows the user to
make corrections prior to the program examining the data and showing that it
knows more than the user! Self-esteem is important to users of your
programs.

So I would advise that you fetch the control data after the user has pressed
OK. Validate it if necessary, and show a list of all detected errors. Then
let the user correct them in their own order and manner. Of course, if there
are no errors, then just proceed to the next stage. It is better to chose
input methods that make it hard for the user to enter bad data in the first
place.

-- 
Derek



TOPICA - Start your own email discussion group. FREE!

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu