Runtime application icons : Smalltalk
This is a discussion on Runtime application icons within the Smalltalk forums in Programming Languages category; Hi group I was looking for definitive advice on how to create the runtime app with a complete set of application icons displayed correctly at runtime. I have changing the icons in the GuiToGo.exe with a resource editor but the icon in the top left of the Shell title bar displays the ? (question mark) icon. I have also changed the shellview properties - largeIcon and smallIcon properties - in the development app the title bar icon is displayed. At runtime it reverts to the the ? question mark icon. I also use InnoSetup to create an installer fwiw. Advice ...
![]() |
| | LinkBack | Thread Tools |
|
#1
| |||
| |||
| I was looking for definitive advice on how to create the runtime app with a complete set of application icons displayed correctly at runtime. I have changing the icons in the GuiToGo.exe with a resource editor but the icon in the top left of the Shell title bar displays the ? (question mark) icon. I have also changed the shellview properties - largeIcon and smallIcon properties - in the development app the title bar icon is displayed. At runtime it reverts to the the ? question mark icon. I also use InnoSetup to create an installer fwiw. Advice and experience please? --- Edward |
|
#2
| |||
| |||
| On 17 Apr, 01:50, "Edward Stow" <ed.s...@gmail.com> wrote: > I was looking for definitive advice on how to create the runtime app > with a complete set of application icons displayed correctly at > runtime. I found the best way was to create a 16px .ico for the small icon property of your main shell window, and a separate 32px .ico for the large icon property (see: http://groups.google.co.uk/group/com...3d3c7567a23259). This seems to work fine for me on winXP and Vista. The only bit I haven't done - is fix the default icon for the app as it displays in the start menu or other places in the ui. I think that is where resource edititing comes into play - or search for ResHacker in this group - Steve gave some tips for that (of course you can use innosetup to provide a separte icon for the start menu - which is why I haven't done that last bit yet). Tim |
|
#3
| |||
| |||
| Edward, or you may want to look into Dolphin Map at http://www.dolphinmap.net/wiki/Main_Page where under the Articles you may find the "Using custom application icons" and the Icon editor entries interesting. Good luck, Janos |
|
#4
| |||
| |||
| Edward, > I have changing the icons in the GuiToGo.exe with a resource editor > but the icon in the top left of the Shell title bar displays the ? > (question mark) icon. Here's how I addressed this issue (with some background info): I assume you assigned something like "Icon fromId: 'MYAPPICON.ICO'" to your view's large and small icon aspect. During Development "Icon fromId: 'MYAPPICON.ICO'" tries to load the icon from the default resource library (DolphinDR006.dll) first. If this fails it tries to locate the icon in the filesystem (relative to your image dir). In a runtime app the default behaviour is the same. First check whether the icon can be found in the default resource library: This fails due to the fact that the dll cannot be found (unless you copied DolphinDR006.dll to the app's directory). Next thing to try is to locate the icon in the filesystem which obviously doesn't work neither in your case - so you'll get the question mark icon. How to prevent this? Well that's how /I/ am doing it: First I change the runtime behaviour to use the app itself as the default library. So if you added your icon(s) using a resource editor or my resource changing framework during deployment the icon will be found withing the app itself. To change the default resource library you have to add the following method to your SessionManager class: defaultResLibPath "Answer the path of the development resource library. 'self argv first' may not include the full path to the executable if started from the command line" ^self imageFileName So if you added your icon as "MYAPPICON.ICO" to the app it should work. Another "trick" I use (especially for small apps w/o a lot of resources) is to use "Icon fromId: '!APPLICATION'". In the image it will use the beach ball icon but in the runtime app it will (with the patch above) use the same icon that is displayed in explorer. Hope this helps. CU, Udo |
|
#5
| |||
| |||
| Runtime icon installation (long) These are my detailed instructions to have your runtime icons on: Application title bar Windows installed group, and icon for your files associated with the application. 1. Create icon images Windows icon files can (should) contain multiple images - one for each size and resolution variation. The minimum that you should include are 16 x 16 pixels - 256 depth 32 x 32 pixels - 256 depth Ideally you could also have 32 bit depth images as well. Use a graphics program create the two images. Save as bmp file. I use GIMP. 2. Create the icon file. Ideally you want to have your multiple images in the one ico file - this makes the later steps much easier. GIMP it seems can handle making the multiple images in the one file but I never figured out how. So I have tried an old utility IconEdit32. (Note that it does not handle 32 bit images.) This utility makes it easy to view the multiple images. It was as simple as copy and paste to include my images. (I had to use paintbrush not GIMP for the copy process.) Save to MyApp.ico 3. Create your application GUIToGo.exe stub. Copy the GUIToGo.exe (found in your Dolphin installation directory) to MyAppGUIToGo.exe 4. Include the MyApp.ico into the stub Open MyAppGUIToGo.exe with a resource editor. I use XN Resource Editor You can delete the existing !APPLICATION Icon group. Then add a new resource, select MyApp.ico As the ico contains multiple images XN Resource Editor automatically created an Icon group. Rename the new Icon Group to '!APPLICATION' (without the quotes ') Save the MyAppGUIToGo.exe. 5. In your shell (the one opened when the app starts) Using the Doplphin View Composer change the shell properties largeIcon - Icon fromId: '!APPLICATION' smallIcon - Icon fromId: '!APPLICATION' At development this will pick up the Dolpin icon. To make the runtime pick up the runtime icons change add to your SessionManager class: defaultResLibPath ^self imageFileName 6. Build / strip the application. Make sure you select your GUIToGo.exe stub in the image stripper. In Package manager, right click on your base package, select the property stubFilePath and select the modified GUIToGo.exe stub. Or in Dolphin Lagoon, the Custom Options button opens the same properties list. Or create your custom ImageStripper class with these entries preset. Strip ... 7. Application document image associations. Almost done except ... what if you want an icon for the files that are opened by your application. For this you will need to use an installation tool. I use InnoSetup with the following entries: ;Icons (inappropiately named) adds entries the windows start menu group. The [Icons] Name: "{group}\My Application"; Filename: "{app}\MyApp.exe" Name: "{commondesktop}\My Application"; Filename: "{app}\MyApp.exe"; Tasks: desktopicon ; the DefaultIcon ValueData entry will locate by index 0 the icon in MyApp.exe [Registry] Root: HKCR; Subkey: ".mya"; ValueType: string; ValueName: ""; ValueData: "My Application"; Flags: uninsdeletekey Root: HKCR; Subkey: "My Application"; ValueType: string; ValueName: ""; ValueData: "My Application"; Flags: uninsdeletekey Root: HKCR; Subkey: "My Application\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\MyApp.exe,0"; Flags: uninsdeletekey Root: HKCR; Subkey: "My Application\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\MyApp.EXE"" ""%1""" ; Flags: uninsdeletekey Remember to modify your RuntimeSession manager main method to open your application with the file. main argv size >= 2 ifTrue: [self mainShellClass filename: (argv at: 2)] ifFalse: [self mainShellClass show]. Links InnoSetup http://www.jrsoftware.org XN Resource Editor http://www.wilsonc.demon.co.uk/d10resourceeditor.htm IconEdit32.exe http://www.onlythebestfreeware.com/p...program_id=135 I spent a lot of time getting my head around icons using GIMP -- this was a waste of my time. If somebody has better tools (free preferred) then I would appreciate a discussion. Finally this is so much harder than it should be -- my colleague with Visual Studio just presses a button to get a basic installer .... Thanks -- |
|
#6
| |||
| |||
| Hi Edward, > Runtime icon installation (long) These are my detailed instructions to > have your runtime icons on: ..... > The minimum that you should include are > > 16 x 16 pixels - 256 depth > 32 x 32 pixels - 256 depth > Ideally you could also have 32 bit depth images as well. Great instructions - however I have one question about the above - I found that if all my icon sizes are in one .ico file then Windows/Dolphin? doesn't pick the correct one in all circumstances - have you found this? For example you can have 48x48 pixel size in there - and it seems to me that windows/dolphin picks the highest size and then scales is down - so this is ok for the Alt-tab icon (the 32x32) however on the taskbar and title bar (the 16x16) it will look terrible. I'm sure it's not supposed to work this way but something seems to make it so, and I found that I had to deliberately split the icons up - or more importantly have a separate .ico with the 16x16 (all colour depths) that I specified as my small icon. I also found it best to leave out the 48x48 icon (is seems to scale up better than it scales down). There's definitely somethng wierd going on - as I agree it should be one icon but I couldn't get it to work, so I gave up. I would be interested if you are observing this behavior - or possibly if putting the .ico into the stub makes the difference (I didn't go that far and just had separate .ico files installed with my app. Tim |
|
#7
| |||
| |||
| Tim, > There's definitely somethng wierd going on - as I agree it should be one > icon but I couldn't get it to work, so I gave up. I would be interested > if you are observing this behavior - or possibly if putting the .ico > into the stub makes the difference (I didn't go that far and just had > separate .ico files installed with my app. I do not encounter this behaviour (anymore). The reason for this weird behaviour is that you need to suply HICON of a specific size for the #smallIcon/#largeIcon aspects as they are set using WM_SETICON. I patched a few method some time ago to do this automatically. The attached Package changes a few methods so that it creates appropriate icons form the small and large icon aspect automatically. Simply assign the /same/ icon to both aspects. If the referenced icon contains multiple sizes the right size for the according aspect will be used automatically. For more details check Icon>>updateIcons. Hope this helps. CU, Udo | package | package := Package name: 'US Runtime Patches'. package paxVersion: 1; basicComment: 'US Runtime Patches Patches several glitches (mainly UI) in Dolphin Applications Version 0.02, April 2007 For version 6 of Dolphin Smalltalk (c) 2007, Udo Schneider <Udo.Schneider@homeaddress.de> Notifyware Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. * The author /should/ (no must) be notified of the Software''s use THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. '. package basicPackageVersion: '0.003'. package methodNames add: #Canvas -> #fillRectangle:startColor:endColor:verticalGradient:; add: #CheckBox -> #onColorRequired:; add: #Icon -> #copyExtent:; add: #Icon -> #copyExtentLarge; add: #Icon -> #copyExtentSmall; add: #Icon -> #createHandle:; add: #ImageView -> #paintImageOn:; add: #ShellView -> #updateIcons; add: #Splitter -> #onPaintRequired:; yourself. package binaryGlobalNames: (Set new yourself). package globalAliases: (Set new yourself). package setPrerequisites: (IdentitySet new add: '..\..\Object Arts\Dolphin\Base\Dolphin'; add: '..\..\Object Arts\Dolphin\MVP\Presenters\Image\Dolphin Image Presenter'; add: '..\..\Object Arts\Dolphin\MVP\Base\Dolphin MVP Base'; yourself). package! "Class Definitions"! "Global Aliases"! "Loose Methods"! !Canvas methodsFor! fillRectangle: aRectangle startColor: startColor endColor: endColor verticalGradient: aBoolean "Added startPosition for first Vertex. Original code didn't do that and therefor always assumed 0@0 as origin" | vertices gRect | #USChanged . vertices := StructureArray length: 2 elementClass: TRIVERTEX. (vertices at: 1) color: startColor; position: aRectangle origin. (vertices at: 2) color: endColor; position: aRectangle corner. gRect := GRADIENT_RECT new. gRect upperLeft: 0; lowerRight: 1. ^Msimg32Library default gradientFill: self asParameter pVertex: vertices dwNumVertex: 2 pMesh: gRect dwNumMesh: 1 dwMode: (aBoolean ifTrue: [GRADIENT_FILL_RECT_V] ifFalse: [GRADIENT_FILL_RECT_H])! ! !Canvas categoriesFor: #fillRectangle:startColor:endColor:verticalGradient:!drawing!public! ! !CheckBox methodsFor! onColorRequired: aColorEvent "Private - Workaround XP bug whereby themed checkboxes are drawn against a solid black background when using a null brush." | canvas back brush | #USAdded. back := self basicActualBackcolor. canvas := aColorEvent canvas. self forecolor ifNotNil: [:fore | canvas forecolor: fore]. back isDefault ifTrue: [^nil]. brush := back brush. back isNone ifTrue: [self isThemed ifTrue: [ThemeLibrary default drawThemeParentBackground: self asParameter hdc: canvas asParameter prc: nil]. canvas backgroundMode: TRANSPARENT] ifFalse: [canvas backcolor: back]. canvas brush: brush. ^brush asParameter! ! !CheckBox categoriesFor: #onColorRequired:!private! ! !Icon methodsFor! copyExtent: aPoint "Returns a copy of the icon with an preferred extent" #USAdded. ^self class fromOwnedHandle: (self createHandle: aPoint)! copyExtentLarge "Returns a copy of the icon with an large Icon extent" #USAdded. ^self class fromOwnedHandle: (self createHandle: SystemMetrics current largeIconExtent)! copyExtentSmall "Returns a copy of the icon with an small Icon extent" #USAdded. ^self class fromOwnedHandle: (self createHandle: SystemMetrics current smallIconExtent)! createHandle: extent "Returns a new handle of the icon with an preferred extent" | spec | #USAdded. instanceHandle notNil ifTrue: [(self loadFromInstance: instanceHandle) ifNotNil: [:hImage | ^hImage]]. spec := self fileSpec. spec isInteger ifFalse: [(self loadFromFile: spec extent: extent) ifNotNil: [:hImage | ^hImage]]. ^(self loadFromInstance: SessionManager current defaultResourceLibrary) ifNil: [self class question handle]! ! !Icon categoriesFor: #copyExtent:!public! ! !Icon categoriesFor: #copyExtentLarge!public! ! !Icon categoriesFor: #copyExtentSmall!public! ! !Icon categoriesFor: #createHandle:!public! ! !ImageView methodsFor! paintImageOn: aCanvas "Added halftone blitting to prevent artefacts when image is scaled" #USChanged. ^(image isNil or: [image handle isNull]) ifFalse: [| rect | rect := self calcRectangle. aCanvas stretchBlitMode: HALFTONE. image drawOn: aCanvas at: rect topLeft extent: rect extent. rect]! ! !ImageView categoriesFor: #paintImageOn:!event handling!private! ! !ShellView methodsFor! updateIcons "Private - Update the large and small icons of the receiver" "Patched to force the system to use small and large extent Icons" | actualLargeIcon actualSmallIcon | #USChanged. actualLargeIcon := (largeIcon notNil ifTrue: [largeIcon] ifFalse: [self icon]) copyExtentLarge. self propertyAt: #largeIcon put: actualLargeIcon. self sendMessage: WM_SETICON wParam: 1 lParam: actualLargeIcon asParameter. smallIcon notNil ifTrue: [actualSmallIcon := smallIcon copyExtentSmall. self propertyAt: #smallIcon put: actualSmallIcon. self sendMessage: WM_SETICON wParam: 0 lParam: actualSmallIcon asParameter]! ! !ShellView categoriesFor: #updateIcons!accessing!public! ! !Splitter methodsFor! onPaintRequired: aPaintEvent "Fixed from self rectangle to self clientRectangle" #USChanged. aPaintEvent canvas fillRectangle: self clientRectangle startColor: self forecolor endColor: self actualBackcolor verticalGradient: self isVertical! ! !Splitter categoriesFor: #onPaintRequired:!event handling!private! ! "End of package definition"! "Source Globals"! "Classes"! "Binary Globals"! |
|
#8
| |||
| |||
| On Apr 20, 12:38 am, Tim M <365n...@gmail.com> wrote: > Hi Edward, > > > > > Runtime icon installation (long) These are my detailed instructions to > > have your runtime icons on: > .... > > The minimum that you should include are > > > 16 x 16 pixels - 256 depth > > 32 x 32 pixels - 256 depth > > Ideally you could also have 32 bit depth images as well. > > Great instructions - however I have one question about the above - I found > that if all my icon sizes are in one .ico file then Windows/Dolphin? doesn't > pick the correct one in all circumstances - have you found this? > I have encountered this problem so far I guess I'm just lucky. During my reading I did come across thi s1995 resource that explains the icon picking process. http://msdn2.microsoft.com/en-us/library/ms997538.aspx "Which Image? Once an RT_GROUP_ICON is chosen, the individual icon image, or RT_ICON resource, must be selected and extracted. Again, if there exists only one RT_ICON resource for the group in question, the choice is trivial. However, if multiple images are present in the group, the following selection rules are applied: 1. The image closest in size to the requested size is chosen. 2. If two or more images of that size are present, the one that matches the color depth of the display is chosen. 3. If none exactly match the color depth of the display, Windows chooses the image with the greatest color depth without exceeding the color depth of the display. 4. If all the size-matched images exceed the color depth of the display, the one with the lowest color depth is chosen. 5. Windows treats all color depths of 8 or more bpp as equal. For example, it is pointless to have a 16x16 256 color image and a 16x16 16bpp image in the same resource-Windows will simply choose the first one it encounters. 6. When the display is in 8bpp mode, Windows will prefer a 16 color icon over a 256 color icon, and will display all icons using the system default palette." My strategy would be to provide the full suit of image if you encounter problems. If you are also targeting vista then http://msdn2.microsoft.com/en-us/library/aa511280.aspx is very useful. -- Edward |
|
#9
| |||
| |||
| Hi Edward, > 1. The image closest in size to the requested size is chosen. > 2. If two or more images of that size are present, the one that > matches the color depth of the display is chosen. Yeah thats what I expected too - however it just didn't do that, it consistently picked the highest resolution 48x48 and then scaled down (it did seem to pick the correct color depth however). Now I've heard others aren't having this problem, I'll reinvestigate - and try udo's package. It could of course be the Icon Workshop application that I used to create the icon? (I was about to buy it as it had seemed quite good). Tim |
|
#10
| |||
| |||
| > I have encountered this problem so far I guess I'm just lucky. I meant to say I have **not** encountered this problem -- Edward |
![]() |
« Previous Thread
|
Next Thread »
| Thread Tools | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| JTree and those small Icons ahead folder, file etc icons. | usenet | Java | 5 | 10-25-2007 12:01 PM |
| How to set locale for application at runtime? | usenet | Java | 6 | 10-15-2007 04:20 AM |
| PS Elements 5.0: Undo/Redo Icons in shortcut bar replaced by commercial Icons | usenet | Adobe Photoshop | 0 | 11-27-2006 12:17 AM |
| Managed icons in develop- and runtime | usenet | Smalltalk | 0 | 09-26-2006 04:42 PM |
| COM+ application icons | usenet | DOTNET | 1 | 02-08-2004 07:53 PM |
All times are GMT -5. The time now is 08:26 AM.


