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)