Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Use of RECT to get coordinates...

SephirothSephiroth Fayetteville, NC, USAPosts: 1,035Member
ScreenToClient and ClientToScreen don't seem to be of much use for what I am trying here. I need to get the cursor position in the child window only. First I need to find out which of four child windows the cursor is in, then I need to find out what coordinates the mouse cursor is in that window. I want the coordinates to start at 0,0 in the child windows' upper-left corner and go to whatever it's max is in each of the four child windows. The four child windows are all STATIC and SS_BITMAP. Thanks for the help.


-[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red]

Comments

  • Sephiroth2Sephiroth2 Posts: 423Member
    : ScreenToClient and ClientToScreen don't seem to be of much use for what I am trying here. I need to get the cursor position in the child window only. First I need to find out which of four child windows the cursor is in, then I need to find out what coordinates the mouse cursor is in that window. I want the coordinates to start at 0,0 in the child windows' upper-left corner and go to whatever it's max is in each of the four child windows. The four child windows are all STATIC and SS_BITMAP. Thanks for the help.
    :
    : -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red]
    :
    POINT pt,pt2;
    HWND hc;
    GetCursorPosition(&pt);
    pt2=pt;
    ScreenToClient(hWnd,&pt);
    hc=ChildWindowFromPoint(hWnd,&pt);
    if(!hc) break;
    ScreenToClient(hc,&pt2);

    At the beginning, hWnd points to the parent window.
    At the end, hc will contain the handle to the child window and pt2 will contain the coordinates within that window. Why you chose your level editor to be just a static bitmap is beyond my comprehension...



  • SephirothSephiroth Fayetteville, NC, USAPosts: 1,035Member
    I chose to do five of the editor windows as static bitmaps, and here's why:

    1) Current Texture:
    Well, the textures can't be displayed in a text window =P

    2) Data Matrix (level layer that contains door info, exits, etc):
    Easy to draw the 50x50 grid in memory, then put into the window, as well as show level info

    3) Wall Matrix (layer that holds all wall textures and effects):
    See #2

    4) Ceiling Matrix (layer that holds all ceiling textures and effects):
    See #2

    5) Floor Matrix(layer that holds all floor textures and effects):
    See #2

    Since none of those five windows will contain any text, and I can double-buffer them for smoother updates, I figured, why not? If you have a way that would work better let me know and I'll check it out. Numbers 2-5 never actually load any bitmaps, but they display a bunch of lines (the grid) and a bunch of colored blocks inside the grid indicating different things.


    -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red]


  • wael_tahonwael_tahon Posts: 65Member
    Take this (I'm working on Borland C++ Builder 3)

    in every child of them go to its events list then to OnMouseMove event double click on it then you have a the X,Y position of the mouse and a place to put some code on it.

Sign In or Register to comment.