Custom Liquid Swipe Animation - flutter

I came across a flutter package named liquid_swipe and I want to customize it. Let me explain what I want to acheive.
So liquid_swipes works like a pageview where on right swipe the current page index changes to (index+1) and on left swipe the current page index changes to (index-1) something like this example.
So let say there is a list [a, b, c, d, e] and let say we are currently on 'b', so on left swipe I would be on 'a' and on the right swipe I would be on 'c'.
Now I want to customize it, let me explain what I want to achieve. Let takes the list [a, b, c, d, e] and let say we are again on 'b'. I want that on right swipe it goes to 'c' as well as on left swipe too it goes to 'c'. I don't want to go back to 'a' again.
So, what I basically I want is to move forward irrespective on left or right swipe, losing the value which was previously present on left side.
Hope I am able to convey what I want. If more information needed please ask. How can I customize it ?

Related

enable context menu for specific cell or item in uitable or uilistbox in matlab

I created a uitable (new version using appdesigner) in MATLAB and wanted to support right clicking on cells and showing a cell specific context menu. Much to my surprise there seemed to be no way to support this.
The context menu only seems to trigger with right click on the uitable, but there is no way of knowing which cell was selected (I think, maybe not?). I created a workaround where I left clicked to select a cell, and during that selection I right clicked using a Java Mouse robot to trigger the context menu. This is super ugly but sort of works. Except, if you need to bring up the menu twice on the same cell. Apparently the cell selected callback only fires once for the cell, until a new cell is selected. I tried literally putting two tables in the same spot and upon selecting one toggling to the other, but the memory of cell selection is table specific, so this only worked for two clicks before both tables had been clicked on the same cell, and toggling visibility back to the first resulted in the cell selection callback not firing (since the cell had not changed) . I tried various approaches to try and deselect the cell (disable/enable, visibility change, data change, etc.), but the cell selection callback never changed.
I even tried having duplicate columns, where the goal was to hide a column, where normally columns 1 and 2 would be visible (column 3 out of view due to size), and then on clicking on column 2, column 2 would hide itself (0 width) and column 3 (an exact duplicate) would move into its place, thus seeming to the user like multi-clicking was supported. Unfortunately I can't set the column width to 0 -- or rather, setting it to 0 doesn't completely hide the column. Instead there seems to be some minimal width to the column and the whole thing looked awful.
I wanted to do something similar with a listbox (right click support), but again I couldn't figure out how to identify where I was right clicking. I eventually settled on left clicking on a listbox and using the mouse robot approach to right click to bring up the context menu. Unlike the uitable, it was fairly easy to clear the selection on the listbox (set listbox.Value = {}). However, I strongly dislike the left click instead of right click approach and I'd rather have multiple columns.
Any suggestions would be much appreciated!!!
So I found an approach that is better than using a robot. I had tried this but was missing a critical portion which I will describe below.
Upon selecting a row in the table, the open command can be used to launch a context menu. My problem was that I didn't know where to launch the menu. I tried CurrentPoint for the figure, but it was 0,0 (or in general not valid)
Here's the current documentation for CurrentPoint:
Current point, returned as a two-element vector. The vector contains
the (x, y) coordinates of the mouse pointer, measured from the
lower-left corner of the figure. The values are in units specified by
the Units property.
The coordinates update when you do any of the following:
Press the mouse button within the figure.
Release the mouse button after pressing it within the figure.
Press the mouse button within the figure, and then release it outside
the figure.
Rotate the scroll wheel within the figure.
Move the mouse within the figure (without pressing any buttons),
provided that the WindowButtonMotionFcn property is not empty.
If the figure has a callback that responds to mouse interactions, and
you trigger that callback faster than the system can execute the code,
the coordinates might not reflect the actual location of the pointer.
Instead, they are the location when the callback began execution.
If you use the CurrentPoint property to plot points, the coordinate
values might contain rounding error.
Here's the critical line again:
"Move the mouse within the figure (without pressing any buttons), provided that the WindowButtonMotionFcn property is not empty."
So when a selection of a cell happens, the CurrentPoint is not valid. However, if we simply define a WindowButtonMotionFcn, then it is!
So the general idea is to have a callback for the table when a cell is selected (SelectionChangedFcn) and to set a dummy callback for WindowButtonMotionFcn
The final point is that a context menu can be launched with the open function if you specify a given location to launch it at. This is different from attaching it to an object and having it automatically launch on right click.
Here's some example code. If you comment out the callback for windows motion then the whole thing doesn't work! Unfortunately it is a left click for targeting the cell but at least it avoids the non-sense I was using with a java robot right click.
classdef wtf < handle
properties
h %struct, this was an appdesigner handle
cm %context menu
end
methods
function obj = wtf()
h = struct;
h.UIFigure = uifigure();
h.UITable = uitable(h.UIFigure);
obj.h = h;
obj.h.UITable.CellSelectionCallback = #obj.tableCall;
%obj.h.UITable.SelectionChangedFcn = #obj.tableCall;
%Some data ...
s = struct;
s.a = (1:4)';
s.b = (5:8)';
obj.h.UITable.Data = struct2table(s);
%Our context menu
cm = uicontextmenu(obj.h.UIFigure);
m = uimenu(cm,'Text','Menu1');
obj.cm = cm;
%WTF ... without this we don't get a valid CurrentPoint
obj.h.UIFigure.WindowButtonMotionFcn = #obj.mouseMove;
end
function tableCall(obj,x,y)
%y - event info
%x - impacted object
cp = get (obj.h.UIFigure, 'CurrentPoint');
open(obj.cm,cp(1),cp(2));
selected_cell = y.Indices;
%selected_cell = y.Selection;
x.Selection = []; %allows reselecting same cell without
%needing to select another cell first
%Now we can run something on the context menu
%that targets the selected cell
end
function mouseMove(obj,x,y)
%we could store a point here
end
end
end

Chart.js - Callback to make a point active

I'm trying to navigate radar's graph point with the rotating bezel on watch and have stacked for several days on this:
A) Via click on graph
Select point (mark blue)
Write value to a HTML element
B) Via callback (inner circle in this sample)
Navigate the point +1 / -1 from A1
Write value to a HTML element (how to retrieve info from tooltip here?)
I have a trouble with B. In my case, B1 is navigating through points, but it doesn't mark the point with blue circle. It is also possible to show tooltip here correctly, but it doesn't write to HTML element like A1 does.
Can you help me please with B1 and B2 please? It's at the end of JS file in Fiddle sample - https://jsfiddle.net/Konvas/aqyrsxL3/22/
function updateView() {
chart.tooltip._active = [chart.getDatasetMeta(currentDatasetIndex).data[currentPointIndex]];
console.log(chart.tooltip);
chart.tooltip.update();
chart.update();
}
Thanks!

Tableau - hide x axis labels except for one that we want to be displayed

I am trying to hide few sensitive details from x axis and keep only the one that has to be sent to the client. Is there a way to achieve this on Tableau ?
Assume i have a bar chart.. My x-Axis has labels, (A, B, C).. I now want to display only C-bar chart and hide labels A and B from the bar chart
Thanks
Sachi
1) If you don't want to show the labels for A and B, you can create a calculated field like
[New Label] = IF [Old Label] = "C" THEN [Old Label] ELSE NULL END
Use this as the new label and you won't see the Labels for A and B.
2) If you don't want to show the Bars for A and B altogether then just filter them out
3) If you are sharing the file and the client has Tableau desktop, he can always unhide/modify the views to take a peek into the sensitive info. The only way in this case, is to remove the data for A & B from the data source and share the resultant views only for C
OR, of course, use Tableau server (can't verify; limited experience)
Hope this helps.

Matlab Impoint and Uicontrol

I'm more on the no0b side of coding, so I apologize in advance for stupid question and / or poor coding practice. Basically, I have a dream of being able to click, place an impoint, record the location of that impoint, and then click again for another point (and record the location of that point) until I hit the "Done" button. However, my code is going sideways.
My button is created with the line below. I've set the variable j to be 1 earlier on in the code, just because I wanted to be able to do two things with CallBack and so I wanted some way to indicate the the button has been clicked (I am, however, certainly not attached to this as a method). When the user clicks the button, I would really like for 1) the loop for new impoints to stop and 2) the image to close.
uicontrol('Style','pushbutton','Position',[80 0 70 20],'String','Done','CallBack','j=0;');
My loop for impoints (with extra stuff that I don't think is relevant removed) is as follows:
for k = 1:2*mboxes*nboxes
if j == 0
close(gcf);
break;
elseif j == 1
fprintf('At line 56, j is %d and k is %d\n', j, k)
h = impoint;
setColor(h,'k');
location = h.getPosition;
end
clear h;
end
At the moment, my problems are two-fold. Really, three-fold, but I can grudgingly live with the third problem. Problem 1, which is most concerning to me, is that I have to click the button just before I want to finish, which is to say that I click the button and then set down another point before the window will close. (In other words, it's going through the loop one time more than I want and I'm not sure how to tell it not to do that.) Problem 2, which I'm sure should tell me something about how it's looping, is that the impoints aren't being deleted as I go along (though h does seem to be deleted at the end). Problem 3, which is aesthetic but really annoys me, is that I keep getting a blue impoint in the upper left corner (0,0) of my image before I click where I actually want.
Any help would be much, much appreciated. :)
I'm not sure about that, but I can only answer here not comment.... so what I guess:
Adressing your problem 2:
your h isn't deleted completly, try to use delete(h) instead of clear. This should also make your problem 3
Adressing your problem 1:
impoint get's your click position whereever you click I assume, even if you click on your button, so the two functions (get the impoint AND the click event) might overlap and give you that error. Maybe a look at the setPositionConstraintFcn can help you with this (enabling the click only for the area you want it to work).

Trying to position a button programmatically, however not in right position according to X,Y

I'm trying to position a button.
Here is the code for the positioning..
[btnAbs setFrame:CGRectMake(57, 50, 106, 99)];
The coordinates I got are from here:
As you can see the xib stats the x & y to be at 57 and 192, which is where I want the button to be.
However when I run it in simulator, here is where its placed:
Obviously i could keep guessing and guessing the x and y coordinates, but this is very time consuming. So how come it's doing this?
Please join the links together when looking at the pics as i need more than 10 reps to post images, or a mod fix this please?
The problem is here:
The “origin” in Interface Builder doesn’t actually affect how the view gets positioned programmatically—it’s just a visual aid. If you click the dot in the top left of that box, the X and Y coordinates will change to the top-left of the view, which are the coordinates you want to pass to -setFrame:.
It looks to me as if you have the GUI designer aligning base upon the center center of your image view. When you do it in code, it is going to align based upon the top left of the image view.
Further, your code places it at a y of 50, where your GUI designer is showing a y coord. of 192.