On Fri, 27 Aug 1999, Claude Lemmel wrote:
> In a card i have a few fields.
> I need to check the datas entered in these field. I perform this check "on
> closeField". If some conditions occur, the closeField handler opens a modal
> dialog with the answer command to ask a question to the user.
> As long as i remain in the same card, that works right.
>
> If i click on a button to go to an other card, when the button receive the
> "down" click, the closeField message is send and the answer modal dialog opens.
> When i release the mouse button, the "mouseUp" is send, the topstack go to the
> requested card, but come in front of the modal window.
>
> I am now in a very uncomfortable situation : the inactive window is in front of
> the active window, and nothing can be done (but press the enter key).
>
> In other xtalk implementations this behaviour does not occur because the modal
> windows are "more modal" than in metacard : the mouseUp event will be send only
> after the modal window is closed.
>
> How to solve the problem in metacard ?
This is a bug: it shouldn't refocus the main stack when a modal is
up. But even if this bug were fixed, it wouldn't solve your problem
because you'd still end up on the wrong card when the modal closes.
The basic problem is that doing data validation checks on closeField
is a bad technique in general. There are too many ways (like this
one) that you can get screwed up. It's also very frustrating to the
user because they may want to fill out the form in an order different
than you had envisioned. For example, I curse Apple every time I try
to change the partition size of a MacOS app by setting the "minimim
size" and it opens a dialog telling me I can't set the minimim size
larger than the recommended size. I want it to let me set them both,
then tell me if I got it wrong when I close the dialog (probably even
better would be if it would just change the preferred size if I set
the minimum size too big).
So, what you should do instead is create a "validateFields" function,
and call it before doing anything that would close the current card.
If validation fails, select the text of the offending field and return
false. If the function returns false, abort the card-closing
operation.
Regards,
Scott
> ----------------------------
> Claude Lemmel / Opus species
> email : [EMAIL PROTECTED]
> website : www.opus-species.com
> ------------------------------
>
>
********************************************************
Scott Raney [EMAIL PROTECTED] http://www.metacard.com
MetaCard: You know, there's an easier way to do that...