For Programmers: Free Programming Magazines  


Home > Archive > Tcl > February 2005 > Button events and error messages









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Button events and error messages
Roberta Hatch

2005-02-24, 4:01 pm

In my application, I have a label that is used to prompt
the user as well as displaying errors the user may make. Nearly
everything in this application is driven by button events.

What I want to do is; display the error message, ring the
bell and give the user some time to see the error.

In a proc, that is associated with a button, if I do...

proc SomethingOrOther { } {

global MSSG

...

if {$error} {
set MSSG "You made a boo-boo!"
after $SOMETIME
return
}
}


... all that happens is that the button stays 'depressed'
and the error message is never seen. I don't get it.

Anyone want to clue me in?

I'm this -><- close, after nearly three ws, to having this
thing do everything I want. This is one of those "I'll finger it out
latter" things that I haven't got to.

B.H.
Bryan Oakley

2005-02-24, 4:01 pm

Roberta Hatch wrote:
> In my application, I have a label that is used to prompt
> the user as well as displaying errors the user may make. Nearly
> everything in this application is driven by button events.
>
> What I want to do is; display the error message, ring the
> bell and give the user some time to see the error.
>
> In a proc, that is associated with a button, if I do...
>
> proc SomethingOrOther { } {
>
> global MSSG
>
> ...
>
> if {$error} {
> set MSSG "You made a boo-boo!"
> after $SOMETIME
> return
> }
> }
>
>
> ... all that happens is that the button stays 'depressed'
> and the error message is never seen. I don't get it.


The "after $SOMETIME" means "pause the application for $SOMETIME ms".

Perhaps what you want is something like this (untested):

if {$error} {
set job [list set MSSG ""]
set MSSG "You made a boo-boo!"
# cancel any pending event to erase the message, then
# schedule an event to erase the message after $SOMETIME
# milliseconds
set task {set MSSG ""}
after cancel $task
after $SOMETIME $task
return
}


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com