Thread: More on VK_RETURN

  1. #1
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708

    More on VK_RETURN

    Hey guys, I am having more trouble getting the return key from an edit window. Currently I am using a method which has usually worked well, Getting and Setting the window long from the edit control...but now it is not working....
    ...So, I am wondering if there is a better way- say, inserting a hook function into thew message loop. But I am unsure how this might be done? I mean, would the VK_RETURN run through the message loop even though it would be associated with that edit control? I just don't know. I just hate it that I cannot obtain all the keys very easily!

    Anyway, any suggestions would be helpful.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  2. #2
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630
    Are you using the edit style ES_WANTRETURN? If not try addint that.
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

  3. #3
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Yes. By the way, besides that what do you do? Do you use the method i first described?
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Edits should handle their own text and do so with little help. Also the edit may be using default processing on the key strokes (default for ENTER is to click the default button on the dialog for single line edits or add a new line). I would not want to handle all the functions of the edit myself.

    The problem is knowing WHEN to get the text from the edit.

    The user may not push enter after they have typed in the text so I would not use that as a method of determining the end of a string.

    The ES_WANTRETURN style only applies to multiline edits. It allows for the ENTER key to advance the line rather than the default (default button is sent BN_CLICKED msg).
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  5. #5
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Well currently, there is a "submit" button, and also, I have the capability to read the text in on the stroke of a timer(if text has changed, the buffer is updated). But I want to add the "return" key functionality as well....BTW, could I possibly add a line of code in the WinMain message loop that would indicate that the key was pressed? Hmmm, I'll try that. Any other ideas are welcome, of course...
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

Popular pages Recent additions subscribe to a feed