2014-02-26 12:56 GMT+04:00 Dmitriy Igrishin <[email protected]>:
>
>
>
> 2014-02-26 12:06 GMT+04:00 Jeffrey Scott Flesher Gmail <
> [email protected]>:
>
> 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest