PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Rolf Brandt on November 20, 2009, 01:40:32 PM

Title: Icon in Statusbar
Post by: Rolf Brandt on November 20, 2009, 01:40:32 PM
Hi everyone,

I want to display an icon in one of the panels of a statusbar to visualize that the program is connected to the  SQLitening Server. (Red = Not Connected, Green = Connected) . Basically no problem, but is there a possibility to resize the icon. I would like it to fit the height of the panel. This works fine when I add the icon in the GUI, but when I change the icon programmatically it does not get resized.

     
      hIcon     = LoadIcon (App.hInstance, "IMAGE_CONNGREEN")
      dwResult  = StatusBar_SetIcon (HWND_FORM1_STATUSBAR, 1, hIcon)


See attached pictures.
Title: Re: Icon in Statusbar
Post by: Haakon Birkeland on November 20, 2009, 02:38:01 PM
First thing that comes to mind is your "second" defined User Tool. 8o)
But I assume you prefer not solving it at the source.
Title: Re: Icon in Statusbar
Post by: Rolf Brandt on November 20, 2009, 02:59:24 PM
Hi Haakon,

I thought of that too, but but even if I take a 16x16 icon it shows as big as a 32x32 icon.
Title: Re: Icon in Statusbar
Post by: Rolf Brandt on November 20, 2009, 03:50:32 PM
OK, I found the solution. By carefully checking the generated code I found how FF3 does it.
Originally I used this code to load the icon:

      hIcon = LoadIcon (App.hInstance, "IMAGE_CONGREENS")

This is what works correctly:
      hIcon = LoadImage( App.hInstance, "IMAGE_CONNGREEN", %IMAGE_ICON, 16, 16, 0 )
      dwResult  = StatusBar_SetIcon (HWND_FORM1_STATUSBAR, 1, hIcon)

Now the icon gets properly sized (See picture).
Title: Re: Icon in Statusbar
Post by: Paul Squires on November 20, 2009, 08:00:07 PM
Can't wait to see this app! Cool!
Title: Re: Icon in Statusbar
Post by: Rolf Brandt on November 20, 2009, 08:26:06 PM
Runs pretty good so far, hope to get a basic version out in a couple of days.
Title: Re: Icon in Statusbar
Post by: Roger Garstang on November 30, 2009, 11:48:19 AM
I have this issue a lot too when using icons with multiple sizes...even the evil Visual Studio can't give me a large button with 48x48 icon unless I only have a 48x48 icon in the ico file.  The Icon Size property was the best edition to FF and allows me to finally have one ico file with multiple sizes and use the 48x48 from it on my button.  Sounds like the same option is needed for Statusbars so it uses the correct icon for you.
Title: Re: Icon in Statusbar
Post by: Rolf Brandt on November 30, 2009, 12:03:35 PM
That's true, Roger. But the workaround using LoadPicture instead of LoadIcon works very good.

If you assign the icon in FF it resizes properly. I think Paul should change the example code in the Function Library's 'FF_StatusBar_SetIcon' procedure to LoadPicture. There you set the size to 16x16 and it resizes correctly.
Title: Re: Icon in Statusbar
Post by: Roger Garstang on November 30, 2009, 12:41:05 PM
Yeah, I guess that would be better to just hardcode it to use 16x16...for some reason I was thinking allowing for larger statusbars when there is no option for such.  If no 16x16 in the file the API should handle the sizing from a 32x32 or whatever on its own and not have FF worry about it.