HTMLInputElementImpl::click() (was: HTMLInputElement::click())

Grimm, Cornelius grimm at valudo.de
Fri Aug 22 09:12:15 BST 2003


Hi,

I don't want to bother you with this issue, but I think I found a reasonable
solution for HTMLInputElementImpl::click()...

Anyway, shouldn't HTMLButtonElement and it's implementation have a method
click(), too?

Below some code, could someone commit it if it's ok? I'm sending all 3
events so onMousePress, onMouseRelease and onClick handlers get called.

Thanks,
Cornelius

[snip]
--- /tmp/html_formimpl.cpp      2003-08-22 09:55:04.000000000 +0200
+++ html/html_formimpl.cpp      2003-08-22 09:56:36.000000000 +0200
@@ -981,7 +981,14 @@

 void HTMLInputElementImpl::click(  )
 {
-    // ###
+    QMouseEvent me1(QEvent::MouseButtonPress, QPoint(0,0), Qt::LeftButton,
0);
+    dispatchMouseEvent(&me1,EventImpl::MOUSEDOWN_EVENT, 1);
+
+    QMouseEvent me2(QEvent::MouseButtonRelease, QPoint(0,0),
Qt::LeftButton, 0);
+    dispatchMouseEvent(&me2,EventImpl::MOUSEUP_EVENT, 1);
+
+    QMouseEvent me3(QEvent::MouseButtonRelease, QPoint(0,0),
Qt::LeftButton, 0);
+    dispatchMouseEvent(&me3,EventImpl::CLICK_EVENT, 1);
 #ifdef FORMS_DEBUG
     kdDebug( 6030 ) << " HTMLInputElementImpl::click(  )" << endl;
 #endif
[snap]

-----Ursprüngliche Nachricht-----
Von: Grimm, Cornelius 
Gesendet: Mittwoch, 20. August 2003 17:18
An: 'kfm-devel at mail.kde.org'
Betreff: HTMLInputElement::click()


Hi,

I'm trying to implement HTMLInputElement::click(), because I'm needing it.

The following code might be a good starting point, but it does not call any
onclick handlers, though I think it should.

Does anybody know how I could call an onclick handler (if there is one)? I
could call KHTMLPart::execute(this, ...), but I feel that's not the nicest
way... ;-)

This is the code sniplet, and something equal could be used for
HTMLButtonElement::click().

html/html_formimpl.cpp, lines 982 ff.:
[snip]
void HTMLInputElementImpl::click(  )
{
  // ### todo: check for onclick handler here...
  switch(inputType()) {
  case HTMLInputElementImpl::SUBMIT:
  case HTMLInputElementImpl::IMAGE:
    activate();
    break;
  default:
    break;
  }
    // ###
#ifdef FORMS_DEBUG
    kdDebug( 6030 ) << " HTMLInputElementImpl::click(  )" << endl;
#endif
}
[snap]

Bye,
Cornelius




More information about the kfm-devel mailing list