Clicking different NSButtons in quick succession - swift

I have an app where clicking on different buttons in a quick succession is necessary but Cocoa seems to disallow it.
I'm using the same subclass of NSButton on all the button instances and the mouseUp/mouseDown events call actions based on the button's instance tag (defined in IB).
The problem is that clicking different buttons quickly triggers the click on the first button but not the current button being clicked. How do I fix this?
Note: I'm using Swift 3 and targeting the latest macOS.

This turns out to have been a bug with a Wacom tablet driver on macOS Sierra. The driver from a previous OS version was outdated and was registering double clicks in an incorrect way. If anyone encounters this problem, be sure to check your system default for double-click speed.
This code snippet prints your double-click speed:
Swift.print(NSEvent.doubleClickInterval())

Related

Adding a shortcut that is already assigned to a button in SwiftUI view to macOS menu bar?

Let's say that I have a Button that I have assigned to a keyboard shortcut, like as shown:
Button("Example Button"){
print("pressed")
}
.keyboardShortcut("b")
This will allow me to add a button that I can trigger by doing command+B. However, this does not show up in macOS’s command bar at all, which is something I would like to add.
I have already considered using the .commands modifier and adding a command over there, but I would like to only manipulate a single window and I would be forced to use NotificationCenter or a centralized app storage variable, both of which manipulates all the windows of an app.
I have also attempted to use the commands thing with looking at which window is the key window, but that does not work reliably either and sometimes ends up manipulating the variables of multiple windows.
Is there a way to add a command bar shortcut for a Button that I have already assigned a keyboard shortcut to?
Ultimately, I found out that there was a focusedSceneObject thing that I could've used in order to remedy this issue. However, this seems to only be available in SwiftUI 4.

External/USB controller integrated with Eclipse

I own an APC MINI USB/MIDI button pad and have been trying to get windows to more or less recognize it as a operating-system-wide input device. My primary use case is to trigger macros or shortcuts in Eclipse.
For example, instead of the current keybinding of ALT+] to clone a window I could press [btn_1] on the external controller to trigger the action. Another example is I could move the slider up and down changing the zoom on my text.
Ideally I'll be able to fire off any macro or shortcut just by pressing a button on the USB pad. If I could get it working at the OS level, I could see having a row of buttons start or focus frequently used applications. For example be able to open FireFox or press a button to navigate a tab to StackOverflow.com.
I supposed I COULD slap together a quick jar with a Midi library, listen for input from the device and map the "notes" (button presses) to a key combination/shortcut but I feel like there has got to be a way to have windows treat the pad as an input device just like a mouse or keyboard. Been all over the internet looking for solutions but most use cases deal with software engineered to handle midi input. Not afraid to write .bat files to cooperate with windows but still need some way to link the buttons on my board to said .bat files.
Any ideas or suggestions would be greatly appreciated!

iOS 11 UIWebView JavaScript Pop-up Issues

I have an issue with updating an app for use with iOS 11. I have the native app, which uses a UIWebView to show a GWT JS application.
However, pop-ups are not working in this app for iOS 11. They can open, a value can be selected, and then they will save the value and close, but then they will reopen exactly as they were prior to closing, and this will continue. If I have 2 drop downs, then the first will have the issue described above, but if I then open a second I will see the values from the first drop-down until I have clicked somewhere else on the screen to close it.
The second time the drop-down comes up it does not automatically close on selection, but does seem to change the value. Additionally, if I close the drop-down without having anything selected then it will pop-up with the same number of items in the list, but all blank, as though the initial pop-up is somehow feeding values into the second pop-up.
I have eliminated the possibility that it is solely a code issue, as the same exact native and web code has the pop-ups working as intended on iOS 11.
I would appreciate any advice on how to deal with this, either because you have experienced this issue yourselves or even just in general issue debugging hints for iOS 11, as this is relatively new to me.
Thanks.
What worked for me was replacing UIWebView with WKWebView from WebKit framework. For the moment I didn't found any better solution to this issue.
Be sure you add WebKit.framework to your target.
This is an ios issue with UIWebView, as mentioned in the previous answer. Replacing this with WKWebView will help to fix this. For anyone who is not able to replace to WKWebView, this issue is fixed in xcode 9.2 beta-2 version. So you can build your app with xcode 9.2 beta-2 (hopefully the stable version will have this fix as well), and try testing in ios 11.2.

Weird iOS5 glitch when keyboard appears after selecting textfield

When selecting a textfield in iOS5 a weird arrow moves from the top left to bottom right of the screen when the keyboard appears. This only happens in iOS5 on the device and the simulator. When running with iOS4 it works as expected.
It only happens the first time the app runs, when i dismiss the keyboard and select the textfield again the arrow isnt visible. I have to restart the app to see it again.
Notes:
Ive posted a video to display what i'm getting http://youtu.be/4Ju2-wQ3hVY
I've tried stripping out other classes and creating a new blank nib with a textbox only but the problem still persists within my project. Creating a new project with xcode 4.3, the problem isnt visible. I've also tried with zombies enabled and didnt get any errors.
Are there new project / build settings that might conflict with the older versions?
This arrow looks like bug to me. I suggest you to file a bug report to Apple and post your issue to http://devforums.apple.com, where maybe issue will be notice by Apple employees and you may get more details on this.

iPhone -- Hunting Line of Code Being Executed

I am working on an iPhone project containing a ton of code. The application receives outside requests and performs actions. However, I cannot figure out exactly where the app begins executing code for a particular event. Is there some functionality in Xcode which would allow me to solve this problem?
Thank you.
Have you tried setting break points in your code? Click on the line numbers column in Xcode on the number to set a break point.
Without knowing more about what these requests are or where they are coming from, its hard to give any advice on what tools Xcode might have, but looking in any project files named <xxx>AppDelegate.m or <xxx>Controller.m would be a good start, placing breakpoints on likely sounding methods.
I figured out that you can use the Instruments Profiler to this end.
Start the profiler
Choose "Time Profiler"
In the bottom left section make sure the following are checked: Show Obj-C only and Hide System Libraries
In the timeline, click on the the point before the event occurred.
Click the left-most icon in "inspection range" (located on the top-bar immediately to the left of clock)
In the timeline, click on the point after the event completed. (optional)
Click the right-most icon in "inspection range"
Inspect the Call Tree.