Change/modify application icon during execution - macos

I want to change the application icon when a button is pressed, or when the app is in a particular state (updating data for example). But I can't find the way to do it.
For example the Steam icon, that when an update is downloading or uploading data have a line of points added to the normal icon of Steam.
I've searched but can not find the way to go.
For example in the case of the Steam icon, and added these lines, superimposing two PNG, the upper transparent background??
Is it possible to completely change the icon at runtime? You mean we have such a square as an icon and pressing a button that becomes such a circle?

Related

Drag and Drop( ctrl+drag) Problems in Xcode

There are two places within Xcode (version 13.3) where I can't drag and drop anymore.
Trying to move a file to a Group. I have tried just clicking and dragging, control-click, option-click, command-click, none work. Instead of dragging the file, the cursor just moves without the selected/highlighted file and highlights whatever file or group it is hovering over.
Trying to drag a button to a View Controller to make a connection. Instead, a popup window appears with three rows, each with corresponding icon, two lines each (title and object type): View Controller, View, Button. (I can't figure out how to capture that screen since I am already holding the control key and mouse button (track pad) but here is a photo.
Update:. All works fine when using a mouse but these two problems always exist when using the trackpad. I did discover that by pressing the Escape key, I can perform the control-drag (but not move files). I have played with the trackpad settings but have not yet been able to figure out how to get rid of that window that appears.
This popup appears whether I am holding the control, option, or command key.
What xcode version are you using, just tried
#1 is working as expected on my xcode13.0
#2 seems to be working for me too..

OSX: Control where the red item count badge on NSCursor appears during drag

My app, which accepts drags from other apps, has to choose its own cursors during a drag over its window.
For example, it has to be able to show the dragLinkCursor even if the user doesn't hold the option and cmd keys down, or show the operationNotAllowedCursor in some other cases.
This works nicely if the user drags single items. But if the user drags multiple items, e.g. several files from Finder, the cursor also gets a red badge showing the number of items in it. And that red badge appears in the location where my chosen cursor is shown, overlapping it. That's not good.
Apart from making my own cursor shapes that place their own badges in a different position, and me predicting where the OS drag handler will decide where to place the red badge depending on the pressed modifiers...
Is there a way to have the red badge appear in a specific location (e.g. always 20 px to the right so that it cannot overlap with the default cursors), or suppress it entirely, so that I could add my own when the mouse cursor is in my window?

How to create a background to keep button on it using resource editor

I am new to work on resource editor i have created two buttons next and previous to change the page in my own created window using CreateDialog function and resource editor.
Now i want to create a strip which i will put at the bottom of my window and I want to put the two buttons "NEXT" and "PREVIOUS" on that strip and that strip can be coloured (not be white). I want to do so because right now my buttons are on the display of image on my created window and which looks odd so i want my buttons to appear on the colourful strip(just like as you can see for .pdf files preview on preview pane) .
Any ideas how to accomplish it ?? I tried to use "COUSTOM CONTROL" option from the toolbox and wanted to colour it and wanted to put button on it but when i run the programme i found that before i had an image display at preview pane but now it is not working(i mean on putting the "COUSTOM CONTROL" on my IDD_MAINDIALOG the preview of the image don't work any more which was working before but when i put "MFC BUTTON" (just to check if it works or not ??)on my IDD_MAINDIALOG then it works(i mean there is no problem in dispaying the image on my window which had stopped working due to "COUSTOM CONTROL") )
So any ideas how to accomplish this strip creation ??
Maybe it would be easier to put the image inside a picture control rather than putting the buttons inside a strip.

Keep part of a window always visible

It is possible to use the SetWindowPos API on Windows to keep a windows always on top of other windows, and there are many questions on StackOverflow dealing with this.
It is possible to keep only part of a Window always visible? I.e. specify a clipping region inside an existing window, and keep only that part visible?
A use case would be the following (on Windows):
User clicks on icon to run app.
User highlights a portion of the screen to focus on (similar to the Snipping Tool on Windows 7)
The highlighted part of the screen remains always visible, even when other windows/programs are moved over the selected region.
I know the issues that would spring up with having other applications that are also set to being topmost. Just curious if this is even possible?
Even if you change part of your window to be transparent to what's below (with a clipping region) it's still going to take all the mouse clicks, etc. that occur over the transparent part.
Your best bet is to create a new smaller window and make it top-most while hiding the main one.

How to get a print screen of the desktop without any windows or the taskbar?

My application is a Windows Forms one.
I tried using the windows wallpaper, but this depends on the "Fill", "Stretch", "Fit" or "Tile" settings.
I just need the image as it is on the desktop, but including the part "under" the taskbar, because this part is visible in case of transparent taskbar.
Why I need this?
Because I have a tray application which slides from under the taskbar when opening. And I need to set a mask there, so it can't be seen sliding, until it reaches the top of the taskbar. Again, this is only a problem when the taskbar is transparent.
I am not sure if I understood your question correctly. But to me, it seems that you need the image that has created wallpaper. If it seems easier, take a look at registry entries at following location:
HKEY_CURRENT_USER\Control Panel\Desktop
This will give you the path, size, tile/no tile etc. information for the wallpaper.
There is a Win32 function called PaintDesktop you could try but unless I'm misunderstanding things you should be able to just adjust the height of your window so it is never really behind the taskbar...
Why I need this? Because I have a tray application which slides from under the taskbar when opening. And I need to set a mask there, so it can't be seen sliding, until it reaches the top of the taskbar. Again, this is only a problem when the taskbar is transparent.
The problem here is that you're starting the slide up from the bottom of the entire screen, rather than starting from the bottom of the screen's working area (i.e., the top of the taskbar). That's why you're seeing the pop-up window slide up behind a transparent taskbar.
Luckily, the solution is much simpler than obtaining the desktop background and/or doing any type of masking. It's also much faster, and it's always good that your eye candy isn't unnecessarily taxing the user's computer.
All you need to do is determine the coordinates of the screen's working area, which is defined by Windows as the area that can be used by applications, not including the taskbar and other side bars. You can obtain this information easily in WinForms by querying the Screen.PrimaryScreen.WorkingArea property. This will return a Rectangle that corresponds to the primary screen's working area. Since you know that the taskbar is always displayed on the primary screen, this is exactly what you want.
Once you have the coordinates of the primary screen's working area, start your pop-up window's slide from the bottom of that.*
This is a good lesson of why you should always include an explanation of why you want to accomplish something. There's often an even better way that you haven't thought of.
*Of course, I'm ignoring the fact that a user might not have their taskbar positioned at the bottom of the screen. You can put it on either side or even on top. It sounds to me like you haven't considered this in your question, either. If this is an app that you're writing only for yourself or for a controlled environment where you can be sure that no one has their taskbar in non-default positions, that might be OK. But if you're writing software to distribute to a wider audience, you will need to take this into account. The rcWork coordinates will be correct, regardless of where the taskbar is positioned, of course, but you will need to know whether to start the pop-up window's slide from the bottom, the left side, the right side, or the top.

Resources