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 » Community » Newbie corner » "Enter" code
"Enter" code [message #37320] Sat, 22 September 2012 05:19 Go to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
What code is equivalent to pressing the enter key?

With a tablet computer with the control by a mouse and there is no keypad how can the "Enter" action be included?

An example is using copy and paste into a text field.
Or editing data in a text field.
With a keyboard pressing "Enter" something can be done.

It may have been in a java app where a small box when clicked it was the same as pressing the "Enter" key.

In U++ how can this be done?
Re: "Enter" code (Solved) [message #37321 is a reply to message #37320] Sat, 22 September 2012 07:37 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
I recall partially how it was done before.
A small box at the end of the edit field when clicked would act as pressing the "Enter" key, like a button or whatever.
It would check the data in the edit field and if valid would process and display the data in decimal degrees, deg min or deg min sec and set the number of decimal places.

When I ported the java code to C++ with a U++ GUI the mouse click was not included. Now that it is being tested on tablets without a keyboard the code will be modified to work with a mouse click.

[Updated on: Sat, 22 September 2012 07:55]

Report message to a moderator

Re: "Enter" code (Solved) [message #37325 is a reply to message #37321] Sat, 22 September 2012 14:26 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3358
Registered: August 2008
Senior Veteran
Hello Nlneilson

In Bazaar/SysInfo you can find all the tools to simulate key pressing and mouse moving and clicking for Windows and Linux.

bool Mouse_GetPos(long &x, long &y);
bool Mouse_SetPos(long x, long y, long windowId);

void Mouse_LeftClick();
void Mouse_LeftDown();
void Mouse_LeftUp();
void Mouse_MiddleClick(); 
void Mouse_MiddleDown();
void Mouse_MiddleUp();
void Mouse_RightClick();
void Mouse_RightDown();
void Mouse_RightUp();
void Mouse_LeftDblClick();
void Mouse_MiddleDblClick();
void Mouse_RightDblClick();

void Keyb_SendKeys(String text, long finalDelay = 100, long delayBetweenKeys = 50);


You can find more info here: http://www.ultimatepp.org/src$SysInfo$SysInfo$en-us.html


Best regards
IƱaki
Re: "Enter" code [message #37328 is a reply to message #37325] Sat, 22 September 2012 19:48 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
Hi Koldo

SysInfo is a good link.
But that is what info can be obtained.

What I was trying to find is something that was equivalent to pressing "Enter" but with a mouse click.

First I realized there must be something to click on.

A left click gives the EditField scope and places the cursor in the characters.
A right click brings up options.
Without getting into a center click something else needed to be clicked.

Then pressing "Enter" in U++ is:
    	if (key == K_RETURN && Point1.HasFocus()) {
            Point1Action();
	        return true;
    	}

then the action:

    void Point1Action() {    // Point1 is an edit field
		if (~Point1 != ""){
			Ln = ~Point1;
			Ln = parseLatLon(Ln);



So an EditField P1 for one character like < then
    	if (Mouse_LeftClick() && P1.HasFocus()) {
            Point1Action();
	        return true;
    	}


I will try this and see if it will work.

It has been a few years since doing this and then it was in java

Thanks Koldo

[Updated on: Sat, 22 September 2012 20:07]

Report message to a moderator

Re: "Enter" code [message #37329 is a reply to message #37328] Sat, 22 September 2012 20:56 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
    	if (Mouse_LeftClick() && P1.HasFocus()) {
            Point1Action();
	        return true;
    	}


This error comes up:
error C2065: 'Mouse_LeftClick()' : undeclared identifier

What has been left out?
Re: "Enter" code [message #37331 is a reply to message #37329] Sun, 23 September 2012 07:01 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
I looked at the Button example and tried this:
//		button <<= THISBACK(Click);
	P1 <<= THISBACK(p1Enter);
	
	
	void p1Enter(){
        Point1Action();
	}


I have:
Button P1;

P1 <<= THISBACK(p1Enter);
throws errors

The p1Enter() works OK from a sub menu but I would like just clicking on the button to work.

With just the U++ core code rather than getting into
void Mouse_LeftClick(); if that can be done.
Re: "Enter" code (Solved and working OK) [message #37332 is a reply to message #37331] Sun, 23 September 2012 07:45 Go to previous message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
It depended on where the THISBACK was placed, just after menu.Set(THISBACK(MainMenu)); worked OK.
Also was able to call Point1Action directly.

menu.Set(THISBACK(MainMenu)); // Set the menu callback
P1 <<= THISBACK(Point1Action);
P2 <<= THISBACK(Point2Action);

edit: The only thing that was necessary was to:
create a button in dlg.lay
Button P1;
P1 <<= THISBACK(Point1Action)

[Updated on: Sun, 23 September 2012 08:25]

Report message to a moderator

Previous Topic: Skylark Compilation
Next Topic: How do I change the cursor to a wait state?
Goto Forum:
  


Current Time: Sat May 04 08:35:56 CEST 2024

Total time taken to generate the page: 0.03152 seconds