in reply to Re: Re: Tk::Entry validate question
in thread Tk::Entry validate question

Ah, I see. Well, one thing you could do is to not validate when there's a delete (using $_ [3]). But that would enable people to erase everything (leaving nothing). I guess you could counteract that by validating on focusout as well, and using invalidCommand to put 0 or so back in the widget (or the last legal entry).

Abigail

Replies are listed 'Best First'.
Re: Re: Tk::Entry validate question
by Baboon (Acolyte) on Jun 14, 2002 at 20:01 UTC
    In my case I really need to have that Tk::Entry to be never empty.
    The reason is following.
    I tried to use same text variable for this Tk::Entry and for other widget Tk::Scale to allow for user to either enter number by hand or to drag scale widget and enter value "visually".

    The point is - that works fine! And it seemed to me to be quite elegant solution.
    And validate works okay, but once Entry became empty (even for just a moment, when that extra validation succeedes) then strange things happen: Scale widget explains that it could not have empty value, then someone prints some Tcl_panic message, garbage could appear after some manipulation and after some other GUI manipulations it could even core dump!

    No coredumps and garbage inside Tk::Entry was noticed in my GUI app otherwise.

    So, I'm still trying to find a way to solve this!

    Best wishes,
    I.R.Baboon.