Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » howto force evaluation after <CR>
Re: howto force evaluation after <CR> [message #10870 is a reply to message #10869] Wed, 01 August 2007 22:46 Go to previous messageGo to previous message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
I have had the same problem and solved it in two different ways depending on the situation:

1) This is the way I think it was intended to be done. Because EditField doesn't actually handle K_RETURN it is passed up to the parent window's Key function, and see if that field has focus:
if (key == K_RETURN && FocusCtrl() == &jog.jog_pos_el)
    // Do whatever 


2) If you really want a callback you can do:
template<class T>
struct WithReturnCallback : public T
{
    Callback WhenReturnKey;
    virtual bool Key(dword key, int count)
    {
        if (key == K_RETURN) {
            WhenReturnKey();
            return true;
        }
        return T::Key(key, count);
    }
}

And then us it as a wrapper for the editfield.

Apologies in advance for any errors in the the above, Idon't have access to a compiler this minute.

Quote:

our LiDAR (think of it as a telescope with a 3000W laser pointer attached)

Awesome! Smile

James.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: there is no fontpusher class (just checking)
Next Topic: How to use droplist and switch
Goto Forum:
  


Current Time: Fri May 17 13:28:16 CEST 2024

Total time taken to generate the page: 0.02974 seconds