Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Making borderless form movable

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials
View previous topic :: View next topic  
Author Message
omoe
Grandmaster Cheater
Reputation: 8

Joined: 11 Jun 2013
Posts: 547

PostPosted: Sat Feb 21, 2015 7:43 am    Post subject: Making borderless form movable Reply with quote

I don't know if anyone else made a tutorial on this or if there is a better way to do it but i was working on a new GUI and thought it may help some people ,
Most of my trainer form is made of one control CHEATPANEL.


First you need the following variables and it should be global variables
Code:
dragging=false;
// Is the user dragging the trainer or not? Default No .
Code:
CurrentmouseX=0;
CurrentmouseY=0;
MovingmouseX=0;
MovingmouseY=0;
CurrentX=0;
CurrentY=0;

// Mouse position is made of 2 veriables X,Y

The following require you to use object or control events

Select the main object which you want the user to be able to drag trainer with and go to event,
We want the following events , OnMouseDown, OnMouseMove , OnMouseUp

Code:
function CHEATPANELMouseDown(sender, button, x, y)
CurrentmouseX,CurrentmouseY =getMousePos()
dragging=true;
end

//On mouse down we want to get the current cursor position and turn the dragging on so if the user
//drag the trainer it will move
Code:
function CHEATPANELMouseMove(sender, x, y)
if dragging then
CurrentX,CurrentY =control_getPosition(CETrainer)
MovingmouseX,MovingmouseY =getMousePos()
control_setPosition(CETrainer, CurrentX-(CurrentmouseX-MovingmouseX),CurrentY-(CurrentmouseY-MovingmouseY))
CurrentmouseX,CurrentmouseY =getMousePos()
end
end

//On mouse move we want to get the position of the form then the new position of the mouse
//To see where it is going , then make the trainer move with the cursor by doing some math
//CurrentX-(CurrentmouseX-MovingmouseX),CurrentY-(CurrentmouseY-MovingmouseY)
//Then we want to update the current cursor position

If you have a trainer form with multiple large controls you simply have to make this into a function and put events on each control then call the function from the event .

_________________
Hey! , Rep++ .
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Sat Feb 21, 2015 7:55 am    Post subject: Reply with quote

Formname.dragNow() can make this easier
http://forum.cheatengine.org/viewtopic.php?p=5519273

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
omoe
Grandmaster Cheater
Reputation: 8

Joined: 11 Jun 2013
Posts: 547

PostPosted: Sat Feb 21, 2015 10:34 am    Post subject: Reply with quote

Dark Byte wrote:
Formname.dragNow() can make this easier
http://forum.cheatengine.org/viewtopic.php?p=5519273

That's more convenient Smile , Was wondering how to change the WindowState from wsNormal to wsMinimized tho? , I checked main.lua and found nothing .
Edit: Used setProperty(Form,"WindowState","wsMinimized") .

_________________
Hey! , Rep++ .
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites