Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 13th, 2005, 5:10 PM   #1
-=PARADOX=-
Programmer
 
-=PARADOX=-'s Avatar
 
Join Date: Oct 2005
Location: Portugal
Posts: 53
Rep Power: 3 -=PARADOX=- is on a distinguished road
Moving Form

Hi there...

How can I drag a form that doesn't have a titlebar?
-=PARADOX=- is offline   Reply With Quote
Old Nov 13th, 2005, 5:22 PM   #2
Brent
Highly Adaptive Penguin
 
Brent's Avatar
 
Join Date: May 2005
Location: United States
Posts: 249
Rep Power: 4 Brent is on a distinguished road
what OS and compiler are you using. could you give me info about what your trying to do
Brent is offline   Reply With Quote
Old Nov 13th, 2005, 5:27 PM   #3
-=PARADOX=-
Programmer
 
-=PARADOX=-'s Avatar
 
Join Date: Oct 2005
Location: Portugal
Posts: 53
Rep Power: 3 -=PARADOX=- is on a distinguished road
Using XP, with C++ Builder.
-=PARADOX=- is offline   Reply With Quote
Old Nov 13th, 2005, 5:53 PM   #4
-=PARADOX=-
Programmer
 
-=PARADOX=-'s Avatar
 
Join Date: Oct 2005
Location: Portugal
Posts: 53
Rep Power: 3 -=PARADOX=- is on a distinguished road
I planning to do a window that is basicaly an image... so it'll not have the titlebar, and i want to make it move if i press the left button of the mouse and drag it.
-=PARADOX=- is offline   Reply With Quote
Old Nov 14th, 2005, 4:14 AM   #5
ivan
Professional Programmer
 
ivan's Avatar
 
Join Date: Sep 2005
Location: serbia & montenegro
Posts: 484
Rep Power: 3 ivan is on a distinguished road
you must code it by yourself... nobody will do it for you.
ivan is offline   Reply With Quote
Old Nov 14th, 2005, 3:15 PM   #6
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Quote:
Originally Posted by ivan
you must code it by yourself... nobody will do it for you.
What the heck has happened to this forum? I don't see him asking for you to code it anywhere... just for some help.

Paradox: you'll need to capture the WM_MOUSEDOWN, WM_MOUSEMOVE and WM_MOUSEUP events, and then find out how far the mouse moves by, well... I can't quite remember, but I'm pretty sure it was easy enough . Anyway, basically, what you do is set a flag to true in WM_MOUSEDOWN and false in WM_MOUSEUP, and then measure the distance travelled and use some weird function to move the window. I can't quite remember much beyond that, having abandoned Windows C++ programming in favour of C#, but Google should get you the rest of the way.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Nov 14th, 2005, 4:34 PM   #7
-=PARADOX=-
Programmer
 
-=PARADOX=-'s Avatar
 
Join Date: Oct 2005
Location: Portugal
Posts: 53
Rep Power: 3 -=PARADOX=- is on a distinguished road
This is how my code looks right now:

void __fastcall TForm1::BackgroundMouseMove(TObject *Sender,
      TShiftState Shift, int X, int Y)
{
        if ( Shift.Contains(ssLeft) ) // this tests if we are pressing the left button of the mouse
       {   
               Form1->Left = Mouse->CursorPos.x;
               Form1->Top = Mouse->CursorPos.y;
        }
}

This works... but not very well...
How do I calculate the distance travelled?

Thanks
-=PARADOX=- is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:15 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC