Home » U++ Library support » LineEdit, EditFields, DocEdit » double-click in EditField
double-click in EditField [message #56279] |
Tue, 16 February 2021 15:43  |
BetoValle
Messages: 204 Registered: September 2020 Location: Brasil Valinhos SP
|
Experienced Member |
|
|
Hi,
in the EditField class I didn't identify an event
WhenLeftDouble, and I wonder if there is a way
better than the rewrite according to the example below?
struct Edx: EditField{
typedef Edx CLASSNAME;
Edx(){};
virtual void LeftDouble(Point p, dword keyflags)
{
PromptOK("ok");
}
};
GUI_APP_MAIN
{
TopWindow app;
app.SetRect(0, 0, Zx(500), Zy(500));
Edx text;
app.Add(text.LeftPos(12,234).TopPos(63,21));
text.SetText( "double click here");
app.Run();
}
|
|
|
Re: double-click in EditField [message #56282 is a reply to message #56279] |
Tue, 16 February 2021 18:44   |
Lance
Messages: 656 Registered: March 2007
|
Contributor |
|
|
Not sure if this is what you are looking for, but
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
struct Edx: EditField{
// typedef Edx CLASSNAME; (Not needed in new code)
Edx(){};
// encouraged to use c++11 new language feature
// in new code to clearly manifest that you are
// override a parent virtual function
//
void LeftDouble(Point p, dword keyflags)override
{
WhenLeftDouble(p,keyflags);
// following line should be dispensible in this
// particular case as I expect it does nothing
//
this->EditField::LeftDouble(p,keyflags);
}
// the following line introduce a new Event
// and note how it comes to effect by calling it in the
// overrided virtual.
//
Event<Point, dword> WhenLeftDouble;
};
GUI_APP_MAIN
{
TopWindow app;
app.SetRect(0, 0, Zx(500), Zy(500));
Edx text;
text.WhenLeftDouble<<[=](Point , dword){ PromptOK("ok"); };
app.Add(text.LeftPos(12,234).TopPos(63,21));
text.SetText( "double click here");
app.Run();
}
|
|
|
|
|
|
Goto Forum:
Current Time: Sun Apr 27 21:15:58 CEST 2025
Total time taken to generate the page: 0.03972 seconds
|