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
Related
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.
I have a problem when the resize function, I do this in the click signal:
if(ShowingDetails){
ui->BtShowingData->setText("<< Hide details");
//this->setMaximumWidth(1050);
//this->setMinimumWidth(1050);
this->resize(1050, height());
}else {
ui->BtShowingData->setText("Show details >>");
//this->setMaximumWidth(750);
//this->setMinimumWidth(750);
this->resize(750, height());
}
The resize method does its work, but I have two QTableView (with filtering) and when the windows grows up, the Tables are painted black, if I click on them, return to normal. I used ui->TbViewDatosNewAlum->repaint(); but nothing happend. If I update the QSqlTableModel, it's not painted black, but I can't do this. Thanks for your time.
I had the same problem and I found a temporary solution. Hope this helps
Before doing resizing job hide the QTableWidget or QTableView:
tableWidget->hide();
After finishing resizing, show the QTableWidget or QTableView:
tableWidget->show();
It may cause flickering in old systems........but I don't think any system is that old. :)
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;)
Using code (not the Interface builder) I need to create an NSButton that looks like an image. Specifically I want to use NSImageNameStopProgressFreestandingTemplate and I need it not to look like button but to look like the image. This means:
1. No 'button down' look
2. No border, no any visibility of the button
Thanks.
I know this response is a bit late, but you could try this, given thisButton:
[thisButton setImage:[NSImage imageNamed:NSImageNameStopProgressFreestandingTemplate]];
[thisButton setImagePosition:NSImageOnly];
[thisButton setBordered:NO];
That last line is the key bit: removing the button border effectively strips it of its bezel, leaving only the image to click on. (BTW, I haven't tried the above code specifically, so you may need to throw in a couple of other tweaks, such as setting the imageScaling or buttonType, to get it to work best.)
One final note: If you're using a template image (as you said you would), Cocoa will automatically display it with a slight dark-grey gradient; when the button is clicked, it will momentarily darken to solid black. This is an automatic "'button down' look" you didn't want; however, it is very subtle, and is a good indicator that the button worked. If you don't want this to happen, you could get an instance of the desired image and [stopImage setTemplate:NO]; on it.
Disable isBordered
let button = NSButton(
image: NSImage(named: NSImage.Name("plus"))!,
target: self,
action: #selector(onButtonPress)
)
button.isBordered = false
If you don't want to use a templated but want the push down highlight anyways, you can also use the following setup for an NSButton:
let imageButton = NSButton()
imageButton.image = NSImage(named: "MyImage")!
imageButton.bezelStyle = .shadowlessSquare
imageButton.isBordered = false
imageButton.imagePosition = .imageOnly
The important thing to make the highlight work on any image is to set bezelStyle to shadowlessSquare.
I know this behavior wasn't requested in the question, but it might be useful for others.
Background:
I am doing some UI work where I allow the user to programatically add and resize controls on a canvas.
Problem:
When resizing a combo box through AS the dropdown stays at the same width as the first time it drops down. So user places combo box on the page, clicks the down arrow, sees the options, selects an option or clicks down arrow again to close, resizes the width of the drop down, clicks the down arrow. Now drop down is the same width as original.
Have tried simple things like setting the width of the dropdown specifically and invalidating display list but it still doesn't work.
Example:
Code Example pending
While trimming my code down to an example I solved my problem. A combobox has a dropdownWidth property. I was trying to set this myComboBox.dropdownWidth = newWidth, which doesn't work (not entirely sure why, didn't dig into the SDK). However if I change my code to myComboBox.dropdown.width = newWidth it actually goes to the dropdown element and re-sizes it directly which does work.
comboBox.dropdown.width did not work for me. I had to use
comboBox.dropdown.percentWidth = 100;
It seems to work without having to call invalidateSize()
In the ComboBox, overriding the set dataProvider and performing the following seemed to work, because the dataProvider field is bound to the collectionChange event.
ComboBox.calculatePreferredSizeFromData(count:int):Object
override public function set dataProvider(value:Object):void {
super.dataProvider = value;
var size:Object = calculatePreferredSizeFromData(dataProvider.length);
this.dropdownWidth = size.width;
this.dropdown.width = this.dropdownWidth;
this.invalidateSize();
}