setCurrentVideo() here is intended to replace the video in the widget
that
created by WWidget* Home::video() of your code.
I got the function working using the logInternalPath change, but do not
see the difference between creating a new function called
setCurrentVideo, or just calling video again, besides the binding...
I know I am missing how this is bound, but WWidget* Home::video() is
bound to a menu call, and returns a WWidget, which creates the page, but
if I call Home::video(), the function gets called, but nothing gets
created, my guess is that since its not returning the WWidget, that
nothing is bound to it, so it doesn't change the page, how do I fix
this, do I need to save the variable returned?
Wt::WContainerWidget *result = new Wt::WContainerWidget();
then call the function, and somehow bind it to the pages, I can't wrap
my mind around this, but I know that in createHome we do this:
result->bindWidget("contents", contents); // this is bound to the
template by ID
to bind the contents to the WWidget returned by Home::video, through the
binding of the menu:
result->bindWidget("menu", mainMenu_);
so I am pretty sure I just can't call the video function a second time,
unless its bound somehow, but I can not find an example of doing this,
but I know it goes back to the this second call not being bound to the
item, even though I don't know how to bind it...
If that makes any sense to you, so how do I bind it?
The project file is here:
http://lightwizzard.com/media/lw/witty-wizard.tar.gz
Its just a modified wt-home example
I know my confusion is around the menu item not calling the function the
second time its called via a click or internal path change, its a cached
page, but I have no idea how this menu actually works, yet, but I am
trying to figure it out, it just seems if I could override this behavior
this would work.
I realize this most be Wt 101 basics, but I don't fully understand the
concept and the API is not helping me.
On Wed, 2014-02-26 at 13:18 +0400, Dmitriy Igrishin wrote:
>
>
>
>
>
> 2014-02-26 12:56 GMT+04:00 Dmitriy Igrishin <dmit...@gmail.com>:
>
>
>
>
>
>
> 2014-02-26 12:06 GMT+04:00 Jeffrey Scott Flesher Gmail
> <jeffrey.scott.fles...@gmail.com>:
>
>
>
> Thanks replying.
>
> This is my problem:
> I have a menu with several items, one is Video,
> I added the Menu item like this:
> mainMenu_ = new Wt::WMenu(contentsStack, contents);
> mainMenu_->addItem(tr("video"),
> deferCreate(boost::bind(&Home::video, this)));
> in the video function:
> Wt::WWidget *Home::video()
> ...
> set the video up based on the path or combo boxes.
> This is a modified wt-home example.
> where I have two WComboBox,Category and Video with a
> list of video's to play, I change the WComboBox:
> videoCombo->activated().connect(this,
> &Home::videoComboChanged);
> where videoComboChanged has:
> Wt::WApplication::instance()->setInternalPath("/video/" +
> std::to_string(categoryCombo->currentIndex()) + "/" +
> std::to_string(videoCombo->currentIndex()), true);
> which sets the path to /video/1/2 for example, but the
> menu item /video seems to be cached, since even
> clicking on a different menu item and back on video
> does not make the page refresh, in fact the player is
> at the same position, and continues to play even
> though I clicked on another menu item, which is not
> what I want either, I want it to stop, but that is
> another issue that needs to be addresses... How do I
> delete the object if the menu changes? Maybe this is
> what the problem is, if I delete the object, maybe it
> will recreate it, but I don't know the API call to do
> that, and could not find it, or an example of how to
> do this, you guys have a lot of examples, but they are
> far to simple, you need real life examples so people
> like me have a chance at figuring things like this
> out.
>
> I don't see this cached feature in the API, but I can
> see why you would want it for static content, but I
> need a way to override this behavior for dynamic
> content, and that's where I am stuck, how do you do
> that?
>
> my thought was that:
> mainMenu_->addItem(tr("video"),
> deferCreate(boost::bind(&Home::video, this)),
> WMenuItem::PreLoading);
> that maybe it was the default of LazyLoading that was
> doing this, but this did not work either, so I have no
> idea what this feature does (Enumeration that
> determines when contents should be loaded. on first
> use seems right, so this has nothing to do with my
> problem, but it seems it needs more options, like to
> destroy the object on menu change), calling the
> function directly is an ugly hack, but didn't work
> either.
>
> Yes /video?v=1 is what I wanted, but what I go was
> duplicates like /video?v=1&v=2&v=3, which is not what
> I wanted, but as you pointed out /video/1 is a pretty
> URL, I do listen to InternalPathChange, but in this
> case, I don't see how I can use it to override the
> cached behavior of the Menu, without an ugly hack of
> logic, when I am sure there is a way to override this
> behavior, I just don't see it in the API.
>
> I am very old school, still want to use queries to do
> things when I don't need to, and still trying to learn
> this API, its like my problem with the Popup menu, I
> don't see a way to handle a call back, and still stuck
> on that problem.
>
> Your example for the media
> http://www.webtoolkit.eu/widgets/media and video
> http://www.webtoolkit.eu/widgets/media/wvideo player
> both keep playing after a video is started, this is
> not good behavior, very bad in fact, so maybe if you
> fix that example, you would see what I mean, you need
> a call back to either delete the object or stop the
> video, in my case deleting would be best, so at this
> point it looks like this is a feature behavior that
> needs to be fixed.
>
> In your case you may want to write an internal path changed
> handler like this:
> void
> Home::internalPathChangedHandler()
> {
> WApplication* app = WApplication::instance();
> if (app->internalPathMatches("/video/")) {
>
> std::string videoNumber =
> app->internalPathNextPart("/video/")
> if (!video.empty())
> setCurrentVideo(videoNumber);
> }
>
>
>
> setCurrentVideo() here is intended to replace the video in the
> widget that
> created by WWidget* Home::video() of your code.
> Ah, and don't forget to attach this handler to
> WApplication::internalPathChanged
> signal.
> And, I am sorry, I meant !videoNumber.empty() rather than !
> video.empty()
> in the previous post.
>
>
>
>
>
>
> --
> // Dmitriy.
>
>
>
> ------------------------------------------------------------------------------
> Flow-based real-time traffic analytics software. Cisco certified tool.
> Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
> Customize your own dashboards, set traffic alerts and generate reports.
> Network behavioral analysis & security monitoring. All-in-one tool.
> http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
> _______________________________________________
> witty-interest mailing list
> witty-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/witty-interest
------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest