Just starting out? Need help? Post your questions and find answers here.
			
		
		
			- 
				
								blueznl							
 
						- PureBasic Expert

 			
		- Posts: 6172
 		- Joined: Sat May 17, 2003 11:31 am
 		
		
											
							- 
				Contact:
				
			
 
				
		
		
						
						
													
							
						
									
						Post
					
								by blueznl » 
			
			
			
			
			viewtopic.php?t=5073&highlight=mouse+offset
is this solved / not solved, or am i overlooking something?
Code: Select all
If OpenWindow(0,0,0,500,300,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"ImageGadget")
    Repeat
      UseWindow(0)
      StartDrawing(WindowOutput())
      x=WindowMouseX()
      y=WindowMouseY()
      Line(x,y,1,1,RGB(0,0,0))
      StopDrawing()
    Until WaitWindowEvent()=#PB_Event_CloseWindow 
EndIf 
 
			
			
									
									( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide 
right here... )
 
						 
		 
				
		
		 
	 
				
			
		
		
			- 
				
								einander							
 
						- Enthusiast

 			
		- Posts: 744
 		- Joined: Thu Jun 26, 2003 2:09 am
 		
		
											- Location: Spain (Galicia)
 
							
						
		
		
						
						
													
							
						
									
						Post
					
								by einander » 
			
			
			
			
			"blueznl": highlight=mouse+offset
is this solved / not solved, or am i overlooking something?
It's solved by Fred in a previous post:
  
Code: Select all
MX=WindowMouseX() - GetSystemMetrics_(#SM_CYSIZEFRAME)
MY=WindowMouseY() - GetSystemMetrics_(#SM_CYCAPTION) - GetSystemMetrics_(#SM_CYSIZEFRAME)
 
			
			
									
									
						 
		 
				
		
		 
	 
	
						
		
		
			- 
				
								blueznl							
 
						- PureBasic Expert

 			
		- Posts: 6172
 		- Joined: Sat May 17, 2003 11:31 am
 		
		
											
							- 
				Contact:
				
			
 
				
		
		
						
						
						
			
													
							
						
									
						Post
					
								by blueznl » 
			
			
			
			
			wellllll... fred said he was planning to change the behaviour after 3.60... that's not the same as coding around 

 
			
			
									
									( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide 
right here... )
 
						 
		 
				
		
		 
	 
	
						
		
		
			- 
				
								einander							
 
						- Enthusiast

 			
		- Posts: 744
 		- Joined: Thu Jun 26, 2003 2:09 am
 		
		
											- Location: Spain (Galicia)
 
							
						
		
		
						
						
													
							
						
									
						Post
					
								by einander » 
			
			
			
			
			And here is a replacement for our beloved MOUSEK from GFA.
I think is better to put StartDrawing() and StopDrawing() outside of the loop.
Code: Select all
Global mx,my,mk
    Procedure mx()
        ProcedureReturn WindowMouseX() - GetSystemMetrics_(#SM_CYSIZEFRAME)
    EndProcedure
    Procedure my()
        ProcedureReturn WindowMouseY() - GetSystemMetrics_(#SM_CYCAPTION) - GetSystemMetrics_(#SM_CYSIZEFRAME)
    EndProcedure
    Procedure MK(EV)
        Select EV
            Case #WM_LBUTTONDOWN  : If MK=2: MK= 3:  Else:   MK=1:  EndIf
            Case #WM_LBUTTONUP    : If MK=3: MK=2:   Else:   MK =0 :EndIf
            Case #WM_RBUTTONDOWN  : If MK=1: MK=3 : Else :  MK=2:   EndIf
            Case #WM_RBUTTONUP    : If MK=3: MK=1:   Else :  MK=0 :  EndIf
        EndSelect
    EndProcedure
OpenWindow(0,0,0,500,300,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"ImageGadget") 
    xant=mx():yant=my()
    StartDrawing(WindowOutput()) 
    Repeat 
        Event=WaitWindowEvent()
        mk(event)
        x=mx()  : y=my() 
        If mk=1  
             LineXY(xant,yant,x,y,RGB(0,0,0)) 
        EndIf
        xant=x:yant=y
    Until Event=#PB_Event_CloseWindow 
    StopDrawing() 
End 
 
			
			
									
									
						 
		 
				
		
		 
	 
	
						
		
		
			- 
				
																			
								kenet							 
						- User

 			
		- Posts: 24
 		- Joined: Wed Apr 30, 2003 5:44 pm
 		
		
											
							- 
				Contact:
				
			
 
				
		
		
						
						
						
			
													
							
						
									
						Post
					
								by kenet » 
			
			
			
			
			line is faster than plot ?
			
			
									
									
						 
		 
				
		
		 
	 
	
						
		
		
			- 
				
																			
								kenet							 
						- User

 			
		- Posts: 24
 		- Joined: Wed Apr 30, 2003 5:44 pm
 		
		
											
							- 
				Contact:
				
			
 
				
		
		
						
						
						
			
													
							
						
									
						Post
					
								by kenet » 
			
			
			
			
			ho ok, forget it
i understand why you using line  

 
			
			
									
									
						 
		 
				
		
		 
	 
	
						
		
		
			- 
				
								einander							
 
						- Enthusiast

 			
		- Posts: 744
 		- Joined: Thu Jun 26, 2003 2:09 am
 		
		
											- Location: Spain (Galicia)
 
							
						
		
		
						
						
						
			
													
							
						
									
						Post
					
								by einander » 
			
			
			
			
			kenet wrote:ho ok, forget it
i understand why you using line  

 
Kenet: 
It's not line, it's LineXY 

 
			
			
									
									
						 
		 
				
		
		 
	 
	
						
		
		
			- 
				
								blueznl							
 
						- PureBasic Expert

 			
		- Posts: 6172
 		- Joined: Sat May 17, 2003 11:31 am
 		
		
											
							- 
				Contact:
				
			
 
				
		
		
						
						
						
			
													
							
						
									
						Post
					
								by blueznl » 
			
			
			
			
			yeah, for some reason plot doesn't do clipping 

 you crashed your test program 

 
			
			
									
									( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide 
right here... )