Clicking on an object (for lack of a better word)

This is a discussion on Clicking on an object (for lack of a better word) within the Windows Programming forums, part of the Platform Specific Boards category; Whats the best way to make something have one reactions when a region is clicked. Much like when a button ...

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    5

    Clicking on an object (for lack of a better word)

    Whats the best way to make something have one reactions when a region is clicked. Much like when a button is clicked (you can click anywhere on the button and it does the same thing) Doing a button is sort of easier since, as far as I understand, a button is a window in itself.

    Is the only way to easily make clickable objects to create a window for them?

    If not how can I do this? It would be sufficient for now to know how to do it for squares or rectangels, but I would like to know how to do this for irregular shaped objects as well.

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,854
    use

    PtInRect()

    with the rect / square you want (use an array if you have many) and the mouse coods from a WM_LBUTTONDOWN

    may need to use

    ClientToScreen() to convert to the same 'scale'. ie both with the origin (0,0) at the top left of the screen (not top left of dialog or dialogs client area)
    "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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Hangman game and strcmp
    By crazygopedder in forum C Programming
    Replies: 12
    Last Post: 11-23-2008, 05:13 PM
  2. Programmically simulate clicking on webbrowser2 object
    By hanhao in forum Windows Programming
    Replies: 1
    Last Post: 06-24-2007, 10:34 PM
  3. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  4. Passing structures to a function
    By earth_angel in forum C++ Programming
    Replies: 5
    Last Post: 07-13-2005, 06:13 AM
  5. Assembly Tutorials
    By JoshR in forum A Brief History of Cprogramming.com
    Replies: 13
    Last Post: 06-11-2005, 09:56 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21