Hello.c with Ext Widgets
Added by Ted Smith almost 15 years ago
I tried using Wt:Ext:LineEdit() in place of WLineEdit()
and in hello.C, and this works except that LineEdit has
no enterPressed() method.
I thought the APIs were identical.
Replies (4)
RE: Hello.c with Ext Widgets - Added by Wim Dumon almost 15 years ago
There are differences in the API... Historically, this was true, but WLineEdit evolved whereas the functionality of the Ext widgets is frozen.
The undocumented protected method lineEdit() returns the underlying WLineEdit object, so you can write your own specialization that has an enterPressed() method.
Wim.
RE: Hello.c with Ext Widgets - Added by Ted Smith almost 15 years ago
To get "enterPress" functionality with Ext, I have extended class Wt::Ext::LineEdit to include an enterPress() method.
The code is:
#include // Needed for enterPressed()
#include
class Ep_LineEdit : public Wt::Ext::LineEdit
{
/*
For some reason Wt::Ext::LineEdit does not have an enterPressed() method.
This class extends Wt:Ext:LineEdit to include an enterPressed() method
similar to Wt::WLineEdit.enterPressed().
*/
public:
// constructor
Ep_LineEdit( Wt::WContainerWidget* parent = 0 ) : Wt::Ext::LineEdit(parent) {}
Wt::EventSignal<>&
enterPressed()
{
//lineEdit() is an undocumented protected method of LineEdit, that returns a WLineEdit;
return lineEdit()->enterPressed();
}
};
I have attached a tarball that contains the Helloworld example using it.
A simple makefile is also included.
Ep_LinEdit.tar.gz (1.75 KB) Ep_LinEdit.tar.gz | Class that adds enterPress() functionality to Wt::Ext::LineEdit |
RE: Hello.c with Ext Widgets - Added by Ted Smith almost 15 years ago
Sorry, but the message I just posted has strange spacings and strange characters.
If you are interested in this, please look in the attached tarball.
RE: Hello.c with Ext Widgets - Added by Wim Dumon almost 15 years ago
Ted,
We'll add this to standard Wt too. It will appear in git soon (and in the next release).
BR,
Wim.