How to add an action event to Tooltip in cocoa - objective-c

Helo Experts,
how to add an action event like button action to tooltip in cocoa,when i click on tooltip i want to perform some action.is it possible in cocoa?.if YES could anybody help how to do this.
I am showing tooltip using NSStatusItem
Thanks in advance.

//tooltip is your NSStatusItem
[tooltip setAction:#selector(tooltipClicked:)];
This calls method tooltipClicked when clicked:
- (void)tooltipClicked:(id)sender { ... }

Related

Change the shadow color of the textfield when got focus

I want my textfield to get blue color shadow when the user taps on the textfield to enter text. I would like to get an example that would update the inputCls inside focus event.
I have set the inpuCls while creating the textfield. I wanted to how know to add it inside FOCUS event.
can anyone help me on this. thanks in advance
You can add a listener in your TextField that listens to the event focus.
The listener can then change the inputCls to what you want.
If you want, you can then listen to the blur event to revert the changes with the same logic.
I strongly suggest you read the documentation about events :
http://docs.sencha.com/touch/2.0.2/#!/guide/events
EDIT : Code sample
listeners : {
focus: function() {
yourTextfield.setInputCls('yourcls');
}
}

Is there a checkbox-like button in WinRT-XAML

Is there a checkbox-like button in WinRT-XAML?
What I mean, is there a button with an IsPressed (or equiv) property that will remain pressed after the user taps it? Then "unselects" after the user taps it again?
ToggleSwitch is what you're looking for
Yes, its called "Toggle Button" or "Toggle Switch".
For more details refer MSDN : WinRT control List

Sencha Touch custom back button

I need to create a custom back button for a nestedlist. In my controller I have created a listener to capture the button tap event as follows:
onCustomButtonBackTap: function(button, e, options) {
this.getMyList().setDepth(node.data.depth-1); <-- seudo code, does not work
},
My question is how can I set the current level of my nestedlist back by one each time the custom button is clicked? Also, if this approach is not correct, please let me know
Thanks is advance for your help and advice
First you need to get the current active item to set the new one... you need to use the methods in my sample code below to accomplish what you are looking for:
var newIndex = this.getMyList().getActiveItem();
this.getMyList().setActiveItem(newIndex-1);
#Jeff, thank you for your answer but I found the following method which works better in my circumstance
onCustomButtonBackTap: function(button, e, options) {
if (this.getMyList().items.indexOf(this.getMyList().getActiveItem()) > 0) {
this.getMyList().onBackTap();
}
},

how to switch between carousel item using button or hyperlink in sencha touch 2?

Is there a way that I can using a button or hyperlink to navigate from first carousel to the second carousel item and vice versa instead of using the indicator? Can someone give me a solution to fulfil this task? Thank you very much in advance!
Call setActiveItem on button's tap event.
tap: function() {
....
carousel.setActiveItem(2); // Moves to the 3rd carousel item.
....
}

How can I interact with "iPad keyboard hiding button" programmatically?

There is a button at bottom right of iPad keyboard which is to hide the keypad.
How can I interact with it programmatically? (get the button then send UIControlEventTouchUpInside to it).
Does anyone know this?
[Edit]
In my case, the keyboard is shown on a modal view.
Overriding disablesAutomaticKeyboardDismissal to return NO as below allows you to dismiss the keyboard when you resignFirstResponder, even when your UITextView is on a modal view. You should put this code to your view controller, from which you initiate the keyboard:
- (BOOL)disablesAutomaticKeyboardDismissal {
return NO;
}
Source: https://stackoverflow.com/a/6268520
In general, you would send the resignFirsResponder message to the active input view.
Something like this? I can't remember where I found this code but I used it to toggle the on-screen keyboard because it would be hidden by default if a bluetooth one was connected.
- (void) toggleKeyboard(UIKeyboardImpl * keyImpl){
if (UIKeyboardAutomaticIsOnScreen()) {
UIKeyboardOrderOutAutomatic();
} else {
UIKeyboardOrderInAutomatic();
}
Edit
I found where I got this code from. It works fine but the catch is that you need to import the private framework GraphicsServices, which would most likely get your app rejected from the App store.