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 » Touchscreen and buttons
Touchscreen and buttons [message #48605] Tue, 08 August 2017 12:10 Go to next message
Giorgio is currently offline  Giorgio
Messages: 175
Registered: August 2015
Experienced Member
Hi there,
I am experimenting with a touch screen on a raspberry. I developed the application on Windows, but it compiled on raspbian with almost no additional effort - just to fix less than 20 lines of code - and I think that is quite remarkable.

The original application was meant to be used with mouse and keyboard, so I have to tune the User Interface to make the application usable: first problem I encountered is with buttons.

If I use a "custom" button (i.e. a button created by me and to which I assigned a function with btn.WhenPush = THISBACK(myFunction); ) the button works as expected. If I use "built-in" buttons (i.e. the button ok and cancel of a CtrlLayoutOKCancel window) they do not work: when I press them on the touch screen, I see that they are pressed and released, but nothing happens. Someone else encountered this problem?

As a workaround, I tried to assign the method Close() to the ok and cancel buttons, but - due to my newbie-ity - I did not figure out how to do that; this is the original code, working without a problem with keyboard and mouse:

#include "ListOp.h"

ListOp::ListOp(MLav _macrolav)
{
	CtrlLayoutOKCancel(*this, t_("Select operator"));
	std::vector<S_OPERATORS> mylist = db_data.FindOperators(_macrolav);
	for (size_t i=0; i<mylist.size(); i++)
		SwOperators.Set((int)i, mylist[i].ID, mylist[i].NAME);
	ok.Ok();
	cancel.Cancel();
}


I tried adding the following:

	[...]

	ok.Ok();
	ok.WhenPush = THISBACK(this.Close);
	cancel.Cancel();
	cancel.WhenPush = THISBACK(this.Close);


...and this:

	[...]

	ok.Ok();
	ok.WhenPush = THISBACK(this->Close);
	cancel.Cancel();
	cancel.WhenPush = THISBACK(this->Close);


...but the code does not compile.

Any suggestion is appreciated.
Regards,
Gio
Re: Touchscreen and buttons [message #48608 is a reply to message #48605] Tue, 08 August 2017 13:26 Go to previous messageGo to next message
rafiwui is currently offline  rafiwui
Messages: 105
Registered: June 2017
Location: Stuttgart, Germany
Experienced Member
What does the compiler complain about?
How are ok and cancel defined?

You don't need this in the THISBACK:
ok.WhenPush = THISBACK(Close);
cancel.WhenPush = THISBACK(Close);

And if you want to exit the app you should use Breaker I guess:
ok.WhenPush = Breaker();
cancel.WhenPush = Breaker();


Greetings
Daniel
Re: Touchscreen and buttons [message #48609 is a reply to message #48608] Tue, 08 August 2017 14:16 Go to previous messageGo to next message
Giorgio is currently offline  Giorgio
Messages: 175
Registered: August 2015
Experienced Member
Hi rafiwui,
thanks for the prompt answer.

The buttons "cancel" and "ok" are defined in the .lay file.

Using Close as you suggested compiles and runs, but the application does not works as intended. A little bit of a context. When launched, GUI_APP_MAIN creates and launches an instance of a class (HomeScreen) that manages and creates the main window of the application. The HomeScreen class, before launching the main window, displays a window (ListOp) asking what is the user that is working. This ListOp windows is the one that has the ok and cancel buttons. In the old scenario, after the user selected the operator and hit ok, the main window was created. Now, if I add the instrucrion ok.WhenPush = THISBACK(Close) the application ends. On the shell from which I launched the application I read "terminate called after throwing an instance of 'Upp::ExitExc'". Does that mean that I have to invoke another method instead of Close?
Thanks,
Gio
Re: Touchscreen and buttons [message #48610 is a reply to message #48605] Tue, 08 August 2017 14:20 Go to previous message
Giorgio is currently offline  Giorgio
Messages: 175
Registered: August 2015
Experienced Member
I've got myself an answer: if i put ok.WhenPush = THISBACK1(Break, 1); it works as intended.
Previous Topic: Hey,need help,i met a problem
Next Topic: Auto-Resize
Goto Forum:
  


Current Time: Sun Aug 18 15:53:03 CEST 2019

Total time taken to generate the page: 0.00818 seconds