I know that using Applescript I can change the size and position of any application's window, but is it possible to get a notification whenever a window has changed it size or position?
If thats not possible, then what I was thinking was making a thread in the background, and constantly check the positions of windows and see if they have changed, if they did then they moved.
But that would take a lot of cpu resources to constantly compare the positions/sizes of window. So is it possible? If not , is there a better way? Thanks!
I'm not sure but i think there isn't a notification for that.
I would listen for mouse events. When the mouse was dragged you can check the windoews for changes. Hope that helpa.
Related
I have a large problem disabling a slider in LabVIEW. Here is my minimal example:
I have a simple Slider, which is disabled and grayed out if the value is higher than 5. Otherwise the Slider is enabled.
If I drag the slider higher than 5, the Slider gets grayed out. But I am still able to move the slider around and change the value. Only after I dropped the Slider, the Slider is disabled to use.
In my opinion, this is a large bug of LabVIEW. Is there any way to disable the Slider correct during drag?
Thank you for your answers!
Additional information:
Like I said, the snippet is only my minimal example to show the basic problem. In my application the following is happening:
I have s statemachine with a state that enables the Slider and a state that disables my Slider. The state can change every moment, so it´s possible, the user is using the slider at the moment of statechange --> moment of disabling. At this moment the slider should be disabled (it only gets grayed out) directly ... not after releasing it. So limiting the maximum is not real target. I want to prohibit all slider actions for a user.
"Link to question asked on NI Discussion Forums"
As suggested by Alexander_Sobolev on the NI forum (but I promise I thought of it independently!), you can end the slider drag by generating a mouse up event. On Windows you can do this with Simulate Mouse.vi from the NI site, which calls mouse_event from user32.dll:
Note that one of that VI's mouse position inputs is erroneously marked as 'Required'; I fixed that before creating the code above.
I do think this is a UI technique that should only be used if it's really justified by the requirements of the system, and if the users will understand why it works like that; otherwise it could make for a frustrating and annoying user experience. I don't think it's a bug, rather a design decision, because the opposite behaviour could be equally undesired in other circumstances.
I guess you could set the slider value to 5 inside the case structure, alongside the greying out, by adding another property node. This should keep the slider stuck at 5, if the user tries to pull it above.
This appears to be strange behavior as the Value Change event is triggered while the mouse button is held down even when the control is Disabled & Grayed Out.
One way I can think of to limit the value would be to update the Data Entry Limits Maximum property for this control and setting the Response to Value Outside Limits for Maximum to be Coerce.
I'm using wxWidgets 2.8 on a Linux box.
I'd like to get notifications of scroll events from wxListCtrl (or wxListView). Basically I want to be notified when someone uses the scrollbars.
I tried with EVT_SCROLLWIN and EVT_SCROLL without success.
Can someone provide me some sample code?
Unfortunately I cannot find any documentation/sample about this topic. Any pointer?
I need to intercept this event because I'm using a wxListView under MOTIF (sic) and when I scroll the list, the new items are not redrawn (basically I see the list empty until I click an item). So, my hack would be to call wxWindow::Redraw() after a scroll.
Any alternative solution to my original problem?
Thanks.
You won't get scroll events for what can be (even if it is not in wxGTK, actually) a native control, this is just not something that wxWidgets guarantees because it is very difficult (and maybe impossible) to implement in general.
Sorry.
I like to zip through lengthy source files quickly. I find ctrl-e/y too jumpy. Smooth scrolling isn't work well enough. Scroll wheel is too slow.
Way back when I made my own vi clone and what I did there is I made the right mouse button dragging scroll the window. This allowed me to zip through source much faster.
Can this be achieved in ideavim as well?
There is no user-exposed configuration for that in IdeaVim. You have to modify its source code. I doubt it would make a good pull request though, since you're the first person ever to request this feature. I guess the simplest workaround is to tweak the scrolling speed of your mouse in the OS settings.
The goal is not to drag a file into a window, but detect when something is (trying) to be dragged into (or above) the window. How could this be done?
There are a couple ways to go about this, but broadly speaking you are talking about 'collision detection'.
Assuming the WINDOW is not moving, you know it's frame and that won't change.
Assuming you can already drag an OBJECT around, you know where the user originally touched the OBJECT, both with respect to itself and it's superview. You also know how far the user has dragged it and to where, since the touch has moved to a new destination.
Since you know all of the above, you can calculate if the visible size of the OBJECT you are dragging has reached the frame of the WINDOW or not.
Respected low-level users of Mac OS, please, help.
I'm trying programmatically to change height of window of safari (or other window). I'm was trying used AppleScript and AXUIElementSetAttributeValue of Carbon, but none of these methods can't increase the window bigger than the height of the screen. But, the width changes without any problems.
I guess I'd be starting with something like SetWindowPos with SWP_NOSENDCHANGING flag under Win32.
Maybe, you can disable this functionality, which monitors the size of the window or completely shutdown the one who is responsible for it?
Note that I want to do this programmatically from an external process - I'm not asking how to control just my own app's window size and position.
Thanks.
It's not possible, search for "Note that any NSWindow with a title bar automatically constrains itself to the screen" in the Window Programming Guide.