Home » U++ Library support » U++ Widgets - General questions or Mixed problems » GLCtrl  don't have  Key() method wokring 
	
		
		
			| GLCtrl  don't have  Key() method wokring [message #52870] | 
			Fri, 20 December 2019 20:50   | 
		 
		
			
				
				
				  | 
					
						  
						Xemuth
						 Messages: 387 Registered: August 2018  Location: France
						
					 | 
					Senior Member  | 
					 | 
		 
		 
	 | 
 
	
		Hello community,  
 
I know it's probably not a bug and it work as intended but the overwrite of virtual key method on GlCtrl inheriteds class don't work ! 
Instead, to manage keytboard input event on the GLCtrl I need to install keyhook like that : 
{
 //Constructor of my GlCtrl inherited class
	InstallKeyHook(&OpenGLExample::CtrlKeyHook); //Activate KeyEvent
}
//Static method of my class
static bool CtrlKeyHook(Ctrl* ctrl, dword key, int count)
	LOG("A key have been pressed !");
	return true;
}
 
But, since all mouse event can be properly overwritten in GLCtrl inherited class, why those key method can't be ? 
 
Thanks in advance 
 
Xemuth
		
		
		[Updated on: Fri, 20 December 2019 20:56] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	
		
		
			| Re: GLCtrl  don't have  Key() method wokring [message #52981 is a reply to message #52980] | 
			Tue, 28 January 2020 12:37    | 
		 
		
			
				
				
				  | 
					
						  
						mirek
						 Messages: 14271 Registered: November 2005 
						
					 | 
					Ultimate Member  | 
					 | 
		 
		 
	 | 
 
	
		Xemuth wrote on Tue, 28 January 2020 11:45Thanks Mirek for having solve my problem, 
 
Another quick question, if the Ctrl didn't had focus before, why mouse event where working fine ? Isn't Mouseevent supposed to require focus ? 
 
Thanks in advance, 
Best Regard. 
 
Xemuth  
 
No, focus is just for keyboard. 
 
BTW, things were a little bit complicated, the real reason why your code was not working outright was NoWantFocus flag in GLCtrl. That prevented TopWindow to assign focus to it on open. I had decided to remove this flag, so your original code would work as is.
		
		
		
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |   
Goto Forum:
 
 Current Time: Tue Nov 04 09:16:53 CET 2025 
 Total time taken to generate the page: 0.06006 seconds 
 |