In Windows phone, how do I find the VerticalOffset of a button? I have a ScrollView with a bunch of content. I want to use ScrollViewer.ScrollToVerticalOffset to get to a specific point (a button), but don't know how to get the position of that point.
if you have both items, you should be able to use TransformToVisual to get the location of one control relative to another, then use that to scroll
see http://msdn.microsoft.com/en-us/library/system.windows.media.visual.transformtovisual.aspx
This is how I get the x and y coordinates of two buttons in my app and move them. Maybe you can do something similar:
Canvas.SetLeft(imUp, Canvas.GetLeft(imUp) + offsetX);
Canvas.SetLeft(imDown, Canvas.GetLeft(imDown) + offsetX);
Related
This sounds like a really simple issue but somehow I do not know how to easily solve it. Inside one row (UIStackView horizontal), I am trying to place two buttons (Cancel and OK) so that Cancel button will be at 1/4 (of the whole length) from left and Ok will be at the 3/4 (of the whole length) from left. I would like the buttons to be fixed length and not stretching to occupy the whole row.
Is there a way to solve it with just one UIStackView with 2 buttons? I am sure there a lots of alternatives (programing a view / use 3 UIStackViews).
Thanks.
hope you can find an easy way using equalWidthconstraints instead for UIStackView.
ie.
1. You should place both buttons in a sam line.and make sure both button's width are same .
2.then you select both buttons and put EqualWidthConstraint.
3.After that pin the left button with top,left and right .
4.pin the right button with right,top spaces,
5.then you double click on the equalwidthconstraints and give Multiplier as you needed ; like 1:4,3:4 something like that. Thank you
Before I endeavor to develop my own solution to this I am wondering if anyone has stumbled on something like this because my search results have yielded nothing.
I am looking for mouse recording software that will allow me to record clicks on specific apllications but it will keep track of the button ids as well so as to repeat those clicks even if the software launches in a different resolution etc.
Thank you in advance.
Autoit does the first half of what you want. Though since it has scripting ability, I imagine you can get the current resolution and calculate the position for a different one.
Example:
; Double click at the x, y position of 0, 500.
MouseClick($MOUSE_CLICK_LEFT, 0, 500, 2)
As anther poster suggested you can use AutoIt for this. However, you want to use ControlClick to click a button/control so your script won't be dependent on screen resolution. You can find the ID of most controls using the AutoIt Window Information Tool and then just use it with ControlClick. For example:
ControlClick("Window Name", "", 762)
You can also use TEXT, CLASS, CLASSNN, NAME, REGEXPCLASS and X \ Y \ W \ to click a control using ControlClick.
I recently noticed the following popup message ("6 occurrences replaced") in Qt Creator (3.4.2).
I like its style and want to use it in my own application. But how is it done? Is this a particular widget or what else? Can someone point me in the right direction.
You could create your own window with round corners like that with text in the middle paid show it when you want too make the window so it takes a parameter text and you can add different text each time and show
So I have a game for Mac OS X built in cocos2D.
I'm using gestures to simulate keyboard commands to control my character and it works really well.
I submitted my game to the AirSpace store and it got rejected on the grounds that the Leap should be used to control my menus as well which is fair enough I guess.
Thing is for the life of me I cannot figure out how this is done. There are no examples out there to show me how to implement it and nothing in the SDK example that makes it clear either.
Does anyone have any examples they'd care to share, I only need it to hijack my cursor and allow a click when held over a button. I really didn't think something so complex would be needed on simply for basic menu navigation.
If this is a Mac only game you should have access to the Quartz event api. This is the easiest way to generate mouse events in OS X...
I would recommend simply tracking the palm (hand) position, and moving the cursor based on that.
This is how I do my palm tracking:
float handX = ([[hand palmPosition] x]);
float handY = (-[[hand palmPosition] y] + 150);
The "+ 150" is the number of millimetres above the Leap device, to use as the '0' location. From there you can move the cursor based on the hand offset from 0.
The function I use to move the cursor (using Quartz):
- (void)mouseEventWithType:(CGEventType)type loc:(CGPoint)loc deltaX:(float)dX deltaY:(float)dY
{
CGEventRef theEvent = CGEventCreateMouseEvent(NULL, type, loc, kCGMouseButtonLeft);
CGEventSetIntegerValueField(theEvent, kCGMouseEventDeltaX, dX);
CGEventSetIntegerValueField(theEvent, kCGMouseEventDeltaY, dY);
CGEventPost(kCGHIDEventTap, theEvent);
CFRelease(theEvent);
}
and an example function call:
[self mouseEventWithType:kCGEventMouseMoved loc:CGPointMake(newLocX, newLocY) deltaX:dX deltaY:dY];
This call will move the mouse. Basically you just pass the new location of the mouse, and the corresponding deltas, relative to the last cursor position.
I can provide more examples such as examples for getting mouse location, clicking the mouse, or even a full mouse moving program...
EDIT 1:
To handle click and drag with Quartz, you can call the same function as above only pass in kCGEventLeftMouseDown.
The catch is that in order to drag you cannot call the kCGEventMouseMoved you must instead pass kCGEventLeftMouseDragged while the drag is happening.
Once the drag is done you must pass a kCGEventLeftMouseUp.
To do a single click (no drag) you simply call mouse down and then up right after, without any drag...
I want to some kind of option list when i hold a selection in a listbox. And i didn't find something default that does this, so i'm trying to build one of my own. So first is there such a feature in windows phone 7?
If not, then i need to open a combo box of listbox at the specified position where the selection event happened, i found out how to get the coordinates of the event as follows:
System.Windows.Point position = e.GetPosition(this);
double pX = position.X;
double pY = position.Y;
Howerver, i can't find a way to set the coordinates of the combobox for example in the view to those coordinates or so.
Help please
Perhaps what you want is a ContextMenu - there is one available in the Silverlight Toolkit for Windows Phone.