Hi,
Does anyone know if this is a bug in the new framework:
I drop an image onto a canvas, and it changes the dock icon to display the dropped image - all perfect so far.
BUT - when I use the following code to reset the icon back to the app’s default - a very low res jagged app icon is displayed:
App.DockItem.ResetIcon
I also tried adding this extra line of code - to no avail:
@Michel,
I need to reset the dock icon back to the original app’s icon - when the window is closed. Therefore I can’t simply drop the original image onto the dropspot.
This was working perfectly until I upgraded to the new framework version of Xojo.
[quote=190639:@Richard Summers]@Michel,
I need to reset the dock icon back to the original app’s icon - when the window is closed. Therefore I can’t simply drop the original image onto the dropspot.
This was working perfectly until I upgraded to the new framework version of Xojo.[/quote]
What is the code you are using to change the dock icon ?
From what I see you can draw anything you want at any time in App.DockItem.Graphics, so you can certainly draw your icon there.
BTW I do not see what is new framework in that at all.
@Michel,
This is the code which successfully changes the dock icon when an image is dropped onto the hotspot:
[code]// ---------------------------------------- SET THE DOCK ICON TO THE NEWLY DROPPED PICTURE OBJECT
Dim g As Graphics = App.DockItem.Graphics
g.ClearRect (0, 0, g.Width, g.Height)
g.DrawPicture (droppedReviewImage, 0, 0, g.width, g.height, 0, 0, droppedReviewImage.width, droppedReviewImage.height)
// ---------------------------------------- DISPLAY THE NEW DOCK ICON
App.DockItem.UpdateNow[/code]
This line of code below (in the window close event) however - does not reset it to the app’s icon - like it used to in the old framework:
[quote=190654:@Richard Summers]@Michel,
This is the code which successfully changes the dock icon when an image is dropped onto the hotspot:
[code]// ---------------------------------------- SET THE DOCK ICON TO THE NEWLY DROPPED PICTURE OBJECT
Dim g As Graphics = App.DockItem.Graphics
g.ClearRect (0, 0, g.Width, g.Height)
g.DrawPicture (droppedReviewImage, 0, 0, g.width, g.height, 0, 0, droppedReviewImage.width, droppedReviewImage.height)
// ---------------------------------------- DISPLAY THE NEW DOCK ICON
App.DockItem.UpdateNow[/code]
This line of code below (in the window close event) however - does not reset it to the app’s icon - like it used to in the old framework:
App.DockItem.ResetIcon
Richard, all you need to do is to draw you original icon picture. If for instance you drag into your project your icon as IconImage, here is what you do to get a nice native icon back :
[quote=190704:@Richard Summers]The reason why I mention the new framework is simply the fact that absolutely no code has been changed - and it worked perfectly in the old framework?
I simply compiled exactly the same code in the newer version of Xojo, and it stopped working.
Never mind - I will do it this way :)[/quote]
The new version of Xojo has portions of new framework. But that code is not.
You should simply refer to 2015R2.2, or to the new version.
App.DockItem.ResetIcon still doesn’t work, or missed something. I searched in the FeedBack and there is an issue which has been verified, but not corrected?
I do as explainded Michel, I redraw MyApplicationIcon_1024 to restore the icon to its initial state.
But I have a question, since I checked in the “Shared” - “Supports Hi-DPI” the IDE indicate 3 pictures 1x, 2x and 3x. That’s normal and I understand why.
But in this case, I need a 1024 x 1024 picture, and only this one. Then I unchecked “Supports Hi-DPI”, I drag&drop my MyApplicationIcon_1024 to add it in my project and I recheck “Supports Hi-DPI”.
But is it the good thing to do? What shall I do? Added 3 times the same picture 1024x1024 in 1x, 2x and 3x ?
from what I gathered from Greg, for a DESKTOP application there is no need to supply the @3x image as that would (currently) only be used in “Xojo for iOS” applications, and only for the iPhone6/7/8+ and the new iPhoneX deployments as those are (currently) the only devices that I know of that support @3x