MonoTouch Rotated Button when Added in Code - button

I have a basic iPad app created using MonoTouch. I have a single view controller.
In code I am adding a button like this:
_button = UIButton.FromType(UIButtonType.RoundedRect);
_button.Frame = new Rectangle((int)location.X - 50, (int)location.Y - 50, 100, 100);
_button.SetTitle("A", UIControlState.Normal);
_viewController.View.AddSubview(_button);
This work great when the iPad is in Portrait mode. If I rotate the screen before adding the button and then try to add the button then it is rotated.
For example if the orientation is currently LandscapeLeft (hardware button on the left side) then when I add the above button the letter A on the button is laying on its right side as if the button is rotated 90 degrees to the right.
How do I add a button in code so that it will always be oriented correctly?

Turns out it was because I was adding the button to the View.Window (for other reasons). I had changed it to adding the button to the View instead and now it works.
False alarm. Learn something every day....

Maybe this can help you:
UIButton button = new UIButton();
...
button.Transform = CGAffineTransform.MakeRotation();
this is a function to rotate the Button;)

Related

GTK# button drawn incorrectly?

My GTK# (v2.12.44) app has a single Window with a single button on it. The button appears to be centered on the Window, because that's where the text appears, but the border/background for the button is shifted up and to the left for no reason I can see. Has anyone seen this before? I saw similar behavior from an Image widget. Note this only happens in Windows, not on (for example) Raspberry Pi/Jesse.
Here's the code:
Application.Init();
var window = new Window("test") {new Button("testing 1, 2, 3")};
window.Maximize();
window.ShowAll();
Application.Run();
Your code works well. Try to add a container before adding a button and set some parametrs you want to. Fill and Expand when adding Button.

Position JavaFX Button in a specific location

My Question is how can i position a javafx button in a specific location.
All the time that i tried to do this simple code is resulting that the Button is only located in the Center of the screen and not on my desired location.
(I'm using StackPane)
Code:
Button button = new Button();
button.setLayoutX(x);
button.setLayoutY(y);
Thanks in advance ,
Amit.
If you want to specify the exact co-ordinates of your node, you can use a Pane instead of StackPane.
Your button, if added to a StackPane or similar layout which supports alignment, must use the translate properties to move the button. You cannot use setLayoutX() or setLayoutY() with these layouts.
Try using the following command to move the button from its initial location :
button.setTranslateX(10);
button.setTranslateY(20);

jQuery Smooth Div Scroll WP - How to start again autoscroll when mouse not over image?

Please I need your help:
I'm using Smooth Div Scroll with wordpress
Is there a way to "stop the autoscrolling when mouse over", "start autoscrolling when mouse not over"?
Right now, autoscrolling works but when I put my mouse over, it stops and does not start again.
I saw it working on this website http://broadcast-architech.com/ however there's no arrow and I would like to keep them, along with the mouse scroll.
Thanks in advance for your help.
The code could look something like this:
// Initialization
var myScroller = $("div#makeMeScrollable").smoothDivScroll({
autoScrollingMode: 'onStart',
autoScrollingDirection: 'endlessLoopLeft'
});
myScroller.on('mouseenter', function(){
myScroller.smoothDivScroll("stopAutoScrolling");
}).on('mouseleave', function(){
myScroller.smoothDivScroll("startAutoScrolling");
});
Here's a demo:
http://jsfiddle.net/tkahn/3McmN/2/

making numberpad smaller?

As per screen :
you can see that as soon as numberpad popping up. its overlapping the some text field, I have in the app. moreover its not having have done or return button so that I can make numpad go away. I have made button to make keyboard go away but I want some more professional way.
please suggest. how can I add return or done button with keyboard and if there is another possible way I can reduce the size of keyboard.
As far as i know it is not possible to make the keybord smaller but what you can do is make your view move up once you have tapped on a UITextField this code will help you with that
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.25];
self.view.frame = CGRectMake(0,-10,320,400);
[UIView commitAnimations];
}
Now to the next issue u have to dismiss the keyboard I like to make it so that the user can just tap the background and it will resign the first responder. You can do that like this
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]
initWithTarget:self
action:#selector(dismissKeyboard)];
[self.view addGestureRecognizer:tap];
In dismissKeyboard
-(void)dismissKeyboard
{
[aTextField resignFirstResponder];
}
Hope this helps

Add Button in TabNavigator Header

i want to add minmun/maximum button on tabnavigator header.......how i could be possible
put the tab navigator and a button in a canvas
set the X and Y of button Y=0 and X=tabnavigator.width - button-width-10
on click of button use Resize function set HeightTo=0 and heightFrom= tabnavigator.width
then play() the resize
to restore heightFrom=0 and heightTo=previous size of navigator
then you got the illusion of minimizing ang maxizing the tab navigator.. please do add some more effects of your desire..
Hope this gives you a idea on it..
Forget how it looks at first. Create a button that simply hides the TabNavigator. I'm sure there are plenty of tutorials out there on how to animate show/hide. Once you have that, move the button where you want it and style it as you wish.
Ive never heard of a tabNavigator header, but if you mean adding buttons to the tabs themselves, then theres an example and source code you could work from with FlexLib SuperTabNavigator

Resources