Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » LineEdit, EditFields, DocEdit » How to capture Key Press events?
Re: How to capture Key Press events? [message #38126 is a reply to message #38125] Sun, 02 December 2012 14:13 Go to previous messageGo to previous message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
If an EditField has fucus and key/s are pressed (or on release) then a function can be called. Or even a mouse over or hover can be used in some instances like highlighting.
Here are a few where the Enter or Return key is pressed.
Any (almost) key or combination can be used.
It is generic as in many languages it is fairly similar.

	bool Key(dword key, int count){
//	bool MyApp::Key(dword key, int count){
    	if (key == K_RETURN && Point1.HasFocus()) {
            Point1Action();
	        return true;
    	}
    	if (key == K_RETURN && Point2.HasFocus()) {
            Point2Action();
	        return true;
    	}
    	if (key == K_RETURN && Distance.HasFocus()) {
            DistanceAction();
	        return true;
    	}
    	if (key == K_RETURN && Angle1.HasFocus()) {
            Angle1Action();
	        return true;
    	}
    	if (key == K_RETURN && Angle2.HasFocus()) {
		    Angle2<<="OK a2";
	        return true;
    	}
    	if (key == K_RETURN && timezone.HasFocus()) {
			String TZ;
			TZ = ~timezone;
    		tz = (int)atof(TZ);
//    		tz = (int)atof(~timezone);
	        return true;
    	}
	}

edit: I have two buttons that when clicked it is the same as pushing the Enter/Return key. It's handy on a tablet so the on screen keyboard does not have to be pulled up.

[Updated on: Sun, 02 December 2012 14:35]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: need some expert advice to extend the LineEdit
Next Topic: BUG: LineEdit "Drag And Drop" violates read-only state
Goto Forum:
  


Current Time: Mon Apr 29 03:57:14 CEST 2024

Total time taken to generate the page: 0.03715 seconds