Thread: some questions

  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    98

    some questions

    hello,
    i have few questions about WinAPI:

    1) how can i make the [TAB] key switching between control windows?

    2) is there a function to check\uncheck a radio button?

    3) how can i set a button which will be pushed when the ENTER was pressed?

  2. #2
    Work in Progress..... Jaken Veina's Avatar
    Join Date
    Mar 2005
    Location
    Missouri. Go Imos Pizza!
    Posts
    256
    Well, I would answer all of those with the API, SendMessage.

    1) Intercept the message sent by the tab key and then send messages to the appropriate controls to set the focus. You could use an enumerated list for ordering, or you could implemet the resource.h definitions for the controls.

    2) Simplest one. Send a message to the button, telling it what to do.

    3) Same principle as number 1. Intercept the enter key message, then send a "push the button" message to the button.

    I realize I've been very vague, but you can find all of these messages at MSDN.com .
    Last edited by Jaken Veina; 06-17-2005 at 11:35 AM.
    Code:
    void function(void)
     {
      function();
     }

  3. #3
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    1) Read this under Dialog Box Keyboard Interface and this

    2) The first few paragraphs of this should suffice.
    Away.

  4. #4
    Registered User
    Join Date
    Apr 2005
    Posts
    98
    thanks for your help.
    1 and 2 are now ok, but i still don't understand how to make a button default for pressing.
    i tried giving it the BS_DEFPUSHBUTTON style but it's not working...

  5. #5
    Work in Progress..... Jaken Veina's Avatar
    Join Date
    Mar 2005
    Location
    Missouri. Go Imos Pizza!
    Posts
    256
    Make it default for pressing.....not quite sure what you mean. You mean give it the focus? Well, the BS_DEFPUSHBUTTON should work. Unless you've got others using that style. Otherwise, you should research Messages for giving buttons a focus and just do it yourself.
    Code:
    void function(void)
     {
      function();
     }

  6. #6
    Registered User
    Join Date
    Apr 2005
    Posts
    98
    do i need another style except BS_DEFPUSHBUTTON ?
    it doesn't work... i press ENTER and nothing happens.
    i also tried giving the focus to the button with SetFocus() and when i press ENTER it still doesn't work.

  7. #7
    Work in Progress..... Jaken Veina's Avatar
    Join Date
    Mar 2005
    Location
    Missouri. Go Imos Pizza!
    Posts
    256
    No, no, no. Just because a button has the focus doesn't mean that you can trigger it with Enter. You need to write your own code to say "When I press Enter, trigger the button that has the focus."
    Code:
    void function(void)
     {
      function();
     }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. questions....so many questions about random numbers....
    By face_master in forum C++ Programming
    Replies: 2
    Last Post: 07-30-2009, 08:47 AM
  2. A very long list of questions... maybe to long...
    By Ravens'sWrath in forum C Programming
    Replies: 16
    Last Post: 05-16-2007, 05:36 AM
  3. Several Questions, main one is about protected memory
    By Tron 9000 in forum C Programming
    Replies: 3
    Last Post: 06-02-2005, 07:42 AM
  4. Trivial questions - what to do?
    By Aerie in forum A Brief History of Cprogramming.com
    Replies: 23
    Last Post: 12-26-2004, 09:44 AM
  5. questions questions questions.....
    By mfc2themax in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 08-14-2001, 07:22 AM