Simultaneous double left click with two mouse pointers on GlovePie - mouse

I am new to GlovePie.
I created a second mouse that moves simultaneously with the first pointer while staying at a fixed distance. My intent is to get a left click from both pointers simultaneously, because my aim is to click on two buttons simultaneously.
Is it possible to do this?
The code I wrote, following the developer's wiki, is this:
Cursor2.PosX = Mouse.CursorPosX + 80
Cursor2.PosY = Mouse.CursorPosY + 0
Cursor2.LeftButton = Mouse.LeftButton
Cursor2.RightButton = Mouse.RightButton
Very simply. Moving works but simultaneous clicks don't. Any suggestions?

A friend of mine found online the solution to my request, which I share here even if I cannot fully understand its code. For example: why there are two mouse (mouse and mouse1) and two cursor (Cursor and Cursor2)? So if any of you are able to comments the lines of code, I would be grateful to understand them!
mouse.Swallow = true
fakemouse.DirectInputX = mouse1.DirectInputX
fakemouse.DirectInputY = mouse1.DirectInputY
var.x1 = mouse1.cursorPosX
var.x2 = 350
mouse.LeftButton = mouse1.LeftButton
if !mouse1.LeftButton then
Cursor2.PosX = var.x1 - var.x2
Cursor2.PosY = mouse1.cursorPosY
endif
if mouse1.LeftButton then
press mouse1.LeftButton
wait 20ms
release mouse1.LeftButton
Cursor2.PosX = var.x1
Cursor.PosX = var.x1 - var.x2
press mouse1.LeftButton
wait 20ms
release mouse1.LeftButton
Cursor2.PosX = var.x1
Cursor.PosX = var.x1 + var.x2
endif

Related

PineScript - Keep in labels in the future when based on a fixed event

Thanks to the PineCoders on Twitter for pointing me in this direction.
I'm tracking both a hard stop (based on an entry indicator) and trailing stop and would like to keep them aligned.
bar_index+5 works great for the trailing stop, but for the hard stop, it simply places it 5 bars after entry indicator.
I've tried factoring in ta.barssince and it seems to have no effect, presumably since it believes the indicator is bar_index or something... I'm at a loss.
Here's the code:
SLAlabelText = str.tostring(SLCalc, "#.##")
var SLALabel = label.new(x = bar_index, y = SLCalc, color = color.red, style = label.style_none, textcolor = color.white, text=SLAlabelText)
if longBoy and stopLossA
label.set_xy(SLALabel, x = bar_index+5, y = SLCalc)
label.set_text(SLALabel, SLAlabelText)
label.set_tooltip(SLALabel, "Stop Loss: " + SLAlabelText)
"longBoy" is the indicator's confirmed state.
Chart image. Apologies for the meme stock, it was the best example.

Execute code continuously in framer

I have a little question about framer. Currently I have a little privat project in which I need to run different actions when the mouse is pressed or not.
To make it easier to talk about, I set up a simple scene with a rectangle. Now I want that the rectangle rotates to the right when the mouse is pressed and rotates to the left when the mouse isn't pressed.
layer = new Layer
x: Align.center
y: Align.center
layer.onMouseDown ->
layer.rotation += 1
layer.onMouseUp ->
layer.rotation -= 1
The problem is that the code only checks once if the mouse is pressed or not. I don't know how I let the program check continuously if the button is pressed or not.
Could anyone help me please?
If you want something to happen repeatedly without events being fired (because mouseUp and mouseDown only get fired once per mouseclick), you can use intervals. Here's an example that does what you describe:
intervalDown = null
intervalUp = null
layer.onMouseDown ->
window.clearInterval(intervalUp)
intervalDown = Utils.interval 0.1, ->
layer.rotation += 1
layer.onMouseUp ->
window.clearInterval(intervalDown)
intervalUp = Utils.interval 0.1, ->
layer.rotation -= 1
You need to create an interval on every event and clear it again using window.clearInterval when the other event fires.
Here's the full example: https://framer.cloud/SEYHy

how to make image tilt correction by user input in matlab

I am developing a semi user interface , in which I want to introduce a user input in which a popup window should come and asking that "do you want to tilt the image?" with yes or no option.
If I press yes again one window should open and ask me to put the required angle through which you want to rotate the figure. If I press no. program should proceed as before. I have tried like this but not working.
dlgTitle = 'Tilt correction?';
dlgQuestion = 'Do you wish to Tilt the image?';
choice = questdlg(dlgQuestion,dlgTitle,'Yes','No', 'Yes');
prompt={'Enter a value of \theta (in degrees)'};
name = 'Tilt correction';
defaultans = {'30'};
options.Interpreter = 'tex';
answer = inputdlg(prompt,name,[1 40],defaultans,options);
end
i am not sure if i am addressing the right problem, but if its "the proceed at no" issue you missed an "if"
dlgTitle = 'Tilt correction?';
dlgQuestion = 'Do you wish to Tilt the image?';
choice = questdlg(dlgQuestion,dlgTitle,'Yes','No', 'Yes');
if strcmp(choice,'Yes')
prompt={'Enter a value of \theta (in degrees)'};
name = 'Tilt correction';
defaultans = {'30'};
options.Interpreter = 'tex';
answer = inputdlg(prompt,name,[1 40],defaultans,options);
end
if you want to adress the [1,40] range as well you need an additional loop. but this should already work for just yes and no

How do I show the pointer after touch interaction in Windows 8

When you touch the screen in Windows 8, the mouse pointer is hidden until you move the mouse (or other pointing device). This happens in both desktop and Metro interfaces.
We have a program that allows people to move the mouse pointer using other input methods (such as a joystick), so I need to ensure the mouse pointer is visible.
How can I force the mouse pointer to be displayed?
you can set the flag of touch feedback.
[setting] ->[control panel]->[pen and touch]->[touch feekback] item,there is a checkbox that is [show visual feedback when touch the screen].If you cann't select the checkbox, you can show the mouse pointer without coding anything when touching the screen.
You can inject mouse movement before you start joystick control, using Windows API:
POINT p;
GetCursorPos(&p);
MOUSEINPUT mi;
mi.dx = (LONG) ((p.x * 65535) / screen_width);
mi.dy = (LONG) ((p.y * 65535) / screen_height);
mi.mouseData = 0;
mi.dwFlags = type | MOUSEEVENTF_ABSOLUTE;
mi.time = 0;
mi.dwExtraInfo = NULL;
INPUT input;
input.type = INPUT_MOUSE;
input.mi = mi;
SendInput(1, &input, sizeof(INPUT));

MS Access - Close form without save design changes, acSaveNo doesnt work

I have a Front End/Back End app in MS Access and I'm having some problems with performance when I close forms.
These forms are always saving before close because in Form_Open I hide some columns and edit the caption. Then, when I close the form, it saves the hidden columns and wastes much time!
I have already done a lot of settings modifications in Access for optimize for FE/BE. But I'm still have problems with forms that save before close. On save event it really wastes a lot of time. With the hide/edit columns routine it takes 20s to save. Without the routine it takes 1s or less, but my data is not saved.
How could I hide/edit these columns without the need to save the form afterwards? Or how could I close the form without saving structure changes?
Unfortunately Access doesn't have a BeforeClose event, and in a Close or Unload event it saves before going to this sub, so I can't cancel it to close later in code.
Hide Code:
'show all columns
For i = 1 To 8
Form_Y_SubF_LP.Controls("Item_00" & i).ColumnHidden = False
Form_Y_SubF_LP.Controls("Quantity_00" & i).ColumnHidden = False
Form_Y_SubF_LP.Controls("DistributionEQ_00" & i).ColumnHidden = False
Next
'Hide unnecessary columns
For i = 8 To ProtQuant + 1 Step -1
Form_Y_SubF_LP.Controls("Item_00" & i).ColumnHidden = True
Form_Y_SubF_LP.Controls("Quantity_00" & i).ColumnHidden = True
Form_Y_SubF_LP.Controls("DistributionEQ_00" & i).ColumnHidden = True
Next
'Change the caption of columns to the real name of each prototype
prot = DLookup("[Prototype]", "Y_Configurações", "[Program]= '" & ProgramName & "'")
For i = 0 To UBound(Split(prot, ";"), 1)
Form_Y_SubF_LP.Controls("Item_00" & i).Properties("Caption") = "Item_" & Split(prot, ";")(i)
Form_Y_SubF_LP.Controls("Quantity_00" & i).Properties("Caption") = "Quantity_" & Split(prot, ";")(i)
Form_Y_SubF_LP.Controls("DistributionEQ_00" & i).Properties("Caption") = "DistributionEQ_" & Split(prot, ";")(i)
Next
A simple solution is to set Close Button = No on the form's property sheet, then add a command button, cmdCloseMe, with this for its On Click event:
Private Sub cmdCloseMe_Click()
DoCmd.Close acForm, Me.Name, acSaveNo
End Sub
If you need your form displayed in Datasheet View, you would need to embed it in a subform control of another form and add the cmdCloseMe button to that form.