Project

General

Profile

SpinBox that Spin too much

Added by Kim Forest almost 11 years ago

Hi there,

i've compiled(linux) Wt from github and strange thing have happen.

when i use the up or down button it increase to the max or min.

it's normal ( i mean some one else have this issue ) or it's just on my side ?

Thanks in advance

Kim


Replies (8)

RE: SpinBox that Spin too much - Added by Стойчо Стефанов Stoycho Stefanov almost 11 years ago

Hey,

I don't think, it is normal. I have this problem as well. Not always, but in a spacial case, although I cannot find what cause this behaviour. Do you use some of the event signals of the spin box widget itself or of its parent widget? It seems to me something like this could cause the problem, but as I said, I'm just guessing.

Regards,

Stoycho

RE: SpinBox that Spin too much - Added by Kim Forest almost 11 years ago

Hi Stoycho,

no I have no slot connected to these spinbox.

and for it's parent, i have many added to an WTable and WTabWidget.

I've just tried on the root() parent and it does the same .

It's giving me the idea that the mouse pressed event is never cleared.

because once you've clicked on the "up" button and you tried to enter a lower value, it goes to the maximal value again.

Kim

RE: SpinBox that Spin too much - Added by Стойчо Стефанов Stoycho Stefanov almost 11 years ago

Hey Kim,

yes, you're right, I commented out all my connections and it still behave in the same way. I suppose there is a bug in the javascript. I hope a developer sees this discussion soon and helps us.

Regards,

Stoycho

RE: SpinBox that Spin too much - Added by Wim Dumon almost 11 years ago

Try reverting this patch:

@@ -949,8 +949,27 @@ void WWebWidget::addJavaScriptStatement(JavaScriptStatement
     otherImpl_->jsStatements_
       = new std::vector<OtherImpl::JavaScriptStatement>();

-  otherImpl_->jsStatements_->push_back
-    (OtherImpl::JavaScriptStatement(type, data));
+  std::vector<OtherImpl::JavaScriptStatement>& v = *otherImpl_->jsStatements_;
+
+  /*
+   * a SetMember is idempotent, if one is already scheduled we do not need
+   * to add another statement.
+   */
+  if (type == SetMember) {
+    for (unsigned i = 0; i < v.size(); ++i) {
+      if (v[i].type == SetMember && v[i].data == data)
+       return;
+    }
+  }
+
+  /*
+   * If the last statement is exactly the same, then it's a dupe, discard it
+   * too.
+   */
+  if (v.empty() ||
+      v.back().type != type ||
+      v.back().data != data)
+    v.push_back(OtherImpl::JavaScriptStatement(type, data));
 }

 void WWebWidget::setToolTip(const WString& text, TextFormat textFormat)

Wim.

RE: SpinBox that Spin too much - Added by Kim Forest almost 11 years ago

Hi Wim,

just rebuild the library with this "fix", and it work perfectly :)

Thanks for all !

Kim

RE: SpinBox that Spin too much - Added by Wim Dumon almost 11 years ago

This patch breaks different things; a proper fix will be in public git soon.

Wim.

RE: SpinBox that Spin too much - Added by Стойчо Стефанов Stoycho Stefanov almost 11 years ago

Hey Wim,

let us know please when the fix is there.

Regards,

Stoycho

RE: SpinBox that Spin too much - Added by Wim Dumon over 10 years ago

Fix should be in public git now.

BR,

Wim.

    (1-8/8)