Hey,

2010/5/18 Aleksey Chirkin <[email protected]>

> Thanks for the reply, virtual internalPathChanged () will be cool!
>
I agree.

I would also like to ask you to give a little time to WMenu, because
> in some cases it is not working properly, for example, select (-1,
> false) in the same internalPathChanged () in my opinion is not
> correct, because the first menu item is selected, only if it is have
> empty pathComponent().
>
I also do not clearly understand why WMenu::internalPathChanged()
do select(-1, false) if internalPathNextPart(basePath_) is empty.
In such case the behavior of WMenu is not always consistent when internal
path changed. Suppose the user follows some URL which conforms to
internalPathMathes(basePath_). If internalPathNextPart(basePath_) is not
empty, Wt simply logs an error and do nothing else. But if
internalPathNextPart(basePath_) is empty it do select(-1, false). I think
that this behavior is not correct, because the users are allowed to add
items
with empty path component and so these items are same as items with non
empty path component. So, I think, that select(-1, false) is unnecessary.


> Also, there are problems with the emitting of a signal
> internalPathChanged () by select (), it is not emitted in all cases
> when it should. This is related to the procedure call selectVisual()
> and then it called twice (first time on a signal, the second of the
> method select()) is alarming, because previous internal path from
> WMenu be the same as the current one.
>
Indeed WMenu does not emits the internalPathChanged when user
selects the menu items for a first time. Please, consider to apply my
patch (in attachment) to fix this.


> WCompositeWidget at a specific internal path is interesting! We look
> forward to!
>
> I agree with my partner. This is a great idea!

> Best regards,
> Aleksey
>

Regards,
Dmitriy
diff --git a/src/Wt/WMenu.C b/src/Wt/WMenu.C
index 62f7884..7269059 100644
--- a/src/Wt/WMenu.C
+++ b/src/Wt/WMenu.C
@@ -235,9 +235,10 @@ void WMenu::select(int index, bool changePath)
 
   WApplication *app = 0;
 
-  if (changePath && internalPathEnabled_) {
+  if (changePath && internalPathEnabled_ && index != -1) {
+    std::string newPath = basePath_ + items_[index]->pathComponent();
     app = wApp;
-    emitPathChange = previousInternalPath_ != app->internalPath();
+    emitPathChange = app->internalPath() != newPath;
   }
 
   selectVisual(index, changePath);
------------------------------------------------------------------------------

_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to