Windows programming

Moderators: None (Apply to moderate this forum)
Number of threads: 3670
Number of posts: 9122

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Use of RECT to get coordinates... Posted by Sephiroth on 9 Apr 2001 at 11:14 AM
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.

<br>-Sephiroth

Report
Re: Use of RECT to get coordinates... Posted by Sephiroth2 on 10 Apr 2001 at 3:15 PM
: 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.
:
: -Sephiroth
:
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...



Report
Re: Use of RECT to get coordinates... Posted by Sephiroth on 10 Apr 2001 at 4:11 PM
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.


-Sephiroth


Report
Re: Use of RECT to get coordinates... Posted by wael_tahon on 15 Apr 2001 at 12:45 AM
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.




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.