Flatpickr -- How To Swipe Through Each Month? - flatpickr

I know there are next and previous arrows to cycle through the months. However, has anyone found a way to "swipe" to either a previous or next month with flatpickr? By "swipe" I am referring to either a click and drag to the next / previous month or of course on a mobile device a touch and drag.

The flatpickr instance exposes the changeMonth(monthNum) method that can be used to switch between months.
I used hammerjs to handle the swipe gestures. You can access the innerContainer of the picker via the picker instance after the picker is ready and hook to the swipeleft and swiperight events.
let hammertime = new Hammer(pickerInstance.innerContainer);
hammertime.on('swipeleft', () => pickerInstance.changeMonth(1));
hammertime.on('swiperight', () => pickerInstance.changeMonth(-1));

Related

event listener when tab is changed

I need to store some data every time I move to some other tab in the same window or some other window using chrome storage API or even when a new tab is created. So, basically when my active tab is no longer active anymore.
So, for example, If I am on tab A and then I move to tab B(or create a new tab). When this switching happens from A to B, I need to save data from the website running in tab A. (I am getting the data from the site in tab A using content script.)
A more concrete example would be, suppose I am on YOutube site and I have a timeout timer running(using a content script). So when I move to some other site I want to stop the time get the current remaining time and save that. and if the other site is youtube too(in tab B) I would start the time from the previously saved value.
Is there any event listener for this? I looked at the documentation for chrome.tabs but could not figure it out.
I saw onActivated event listener but I am not sure if that would be useful.
Or is there some other way to achieve this?
Yes, according to the documentation onActivated:
Fires when the active tab in a window changes.
As an alternative, also can use content scripts that notify your extension when a page gain or loses focus with window.onfocus and window.onblur.
This way you'll be able to track the visibility of the tabs, though you should carefully select the required permission.

custom seekbar/scrubber on a media player UWP

So I'm coding a music player and don't want to use their defualt mediaplayer control panel.
I have a slider object (SeekBar) and I know I can update it to display the postion i am in a current song as such:
SeekBar.Value = (int)PlayMusic.Position.TotalMilliseconds;
So when I call the above the bar move to the exact position I need it to be
So how can I start a thread (async method?) that calls a function that loops the above every millisecond. I'm pretty new and have been trying this for a while.

How can I add a bit of custom functionality to every CRM 2011 grid ribbon?

I have a small bit of custom functionality which I need to run from each and every grid ribbon in CRM 2011. The functionality is in a JS web-resource and I can attach it to a button enable rule and it all works fine.
The issue is that I need this to run on every grid in CRM, but I'm struggling to find something in the ribbon which appears on every screen. I did try attaching it to one of the buttons in the Jewel menu, but this only fires if the user clicks on the "File" tab.
Any thoughts...?
The jewel menu button is a good idea.
Add an anonymous JavaScript function to the library you are adding to the jewel button.
This will run when the library is loaded, just after the page loads:
var whatever = 30; // maybe you do not need a parameter
(function (what) {
/* Do what you need to do */
}(whatever));
If it’s on premise I‘d inject my script to the ribbon.js or global.js or some other js and ping from there.
Another option, less intrusive , is to use a resource that runs in each and every form i.e. myframewrok.js. This resource can check for the opener and inject the script to the opener dynamically.
A third options might be to ping a web service using a plug-in registered on execute or retrieve multiple messages which fire repeatedly for any grid in the system.
In the end we attached it to the "Advanced Find" button as this appeared on every ribbon that we needed the functionality on. The Jewel menu did not seem to work for us as it only fired when the user actually clicked the "File" button.

Why isn't MvxStandardTableViewSource SelectedItem updating properly?

I'm trying to bind a UITableView to an ObservableCollection<MyTypeViewModel> using MvxStandardTableViewSource, and I'm getting weird behavior and bindings that aren't working
The (partial) code is this:
tblFeatures = new UITableView ();
mSource = new MvxStandardTableViewSource(tblFeatures, "TitleText Name");
var set = this.CreateBindingSet<MyTypeView, MyTypeViewModel> ();
set.Bind(mSource).To (vm => vm.Objects);
set.Bind(mSource).For(s => s.SelectedItem).To (vm => vm.SelectedObject);
set.Apply ();
What I'm seeing is that when I select an item in the table, it does update SelectedObject with the new value. But when I change SelectedObject by some other means, the table does not update the displayed selected item. I have verified that the SelectedObject really is being changed, by setting a breakpoint and by binding another control to it; the other control (a label) does change as the selection changes, but the UITableView does not.
Am I doing something wrong, or could this be an issue in MVVMCross?
The selecteditem binding was requested as a 'nice to have' and was mainly requested for the user story where a user clicks on a list item - so this is currently a 'one way to source' implementation.
The very basic details and some code can be found via - https://github.com/slodge/MvvmCross/issues/278
In truth, the current binding is abusing the 'selected' paradigm - as it doesn't really reflect the selection state of the cell and also has no handling of mutiselect - instead it just lets the viewmodel know the latest tapped item.
If there are genuine user stories/requirements for full two'way binding, then these should be addable - eg if the user story were for scrolling the item into view then 'scrollToRowAt' could be used - see How to scroll UITableView to specific position - but this again might not be true 'selection' within the uitableview.
if you wanted to implement this yourself it should be fairly straight-forward to override the binding with your own one (see the custom binding n+1 in http://mvvmcross.wordpress.com for an intro on custom bindings).
could this be an issue in MVVMCross?
Overall I think I'd categorise it as a known limitation of that particular binding caused by lack of user demand and by some confusion over whether selection genuinely means selection in the touch screen era.
if it was logged as a bug I'd say it wasn't.. If it was logged ss a feature request I'd try getting as much user input as i could about what devs really want from this, whether they want true cell selection or scroll into view, both or something more.
By other means you mean not from UI thread I presume. Please try by invoking the change on UI thread.

MFC CDateTimeCtrl SetTime Issue

I have a CDateTimeCtrl in my code for time which is initialized by current time and is enabled/disabled and time setting is done by click of a tree control.
Now, when I click an item of tree control, first the dateTime control is enabled and a time is set according to data present in my tree control (Say 14:25:17).
Then, when I click on another item of tree control, time is set in the time control (Say 14:26:30).
Now, when I click again on previous tree item, although my SetTime function is called with correct time value (which is 14:25:17) but time which is set and displayed in the control is not updated (it still is 14:26:30).
The GetTime also returns 14:26:30 value.
The code I am using to set the time is:
UINT64_T newSTime = info.m_uiStartTime / 1000; // Time I receive from tree control (in msecs)
CTime start_time(newSTime);
m_StartTime.SetTime(&start_time);
I have tried SetRedraw, Invalidate, UpdateData but nothing is working.
Hope you guys can suggest something.

Resources