On Thu, Oct 03, 2002 at 04:32:25PM +0500, s. venkata krishnan wrote:
> Hi All
> 
> I am working in picogui for the past one week. I am having a problem with the bitmap.
> 1.can i able to add two bitmaps in one button 
> i got play bitmap and pause bitmap in one button. when i open an application play 
>button has to be displayed. when i click on play,play button has to be changed to 
>pause button which is present in that. when i click on pause button again the play 
>button has to be displayed.
> 
> can i able to toggle between two bitmaps. is there any possiblity of doing it on 
>picogui.
> 
> If there is any option please let me know it and if  u got any example let me know 
>where it is 

Yes, you can change the bitmap on the button just like you would normally set it. 
Allocate your play and pause bitmaps in your program's initialization:

   pghandle bPlay, bPause;
   bPlay = pgNewBitmap(pgFromFile("playbutton.png"));
   bPause = pgNewBitmap(pgFromFile("pausebutton.png"));

Then you can easily switch between them with commands like:

   pgSetWidget(myButton,
               PG_WP_BITMAP, bPlay,
               0);

Another option you might find helpful if you have a lot of bitmaps to store is to use 
a theme. This also allows the user more flexibility, since one file can be replaced to 
change the application's look if the app is well written. For example, in your theme:

   object "my_application/play" bitmap1 = LoadBitmap("playbutton.png");
   object "my_application/pause" bitmap1 = LoadBitmap("pausebutton.png");

Then in your app initialization, load the theme:

   pgLoadTheme(pgFromFile("mytheme.th"));

Note that if you don't need the theme for the entire length of your program's 
execution, pgLoadTheme returns a handle you can delete. Then when you want to switch 
buttons, use something like:

   pgSetWidget(myButton,
               PG_WP_BITMAP, pgThemeLookup(pgFindThemeObject("my_application/play"),
                                           PGTH_P_BITMAP1),
               0);

Also note that the result from pgFindThemeObject shouldn't change, so you can store it 
to avoid calling pgFindThemeObject each time the button changes.

--Micah

> 
> Thanks
> Venkat
> -------------------------------------------------
> Sify Mail - now with Anti-virus protection powered by Trend Micro, USA.
> Know more at http://mail.sify.com
> 
> Want to get into IIM? Take the Sify Mock CAT now!
> http://education.sify.com/mockcat
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Pgui-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/pgui-devel

-- 
Only you can prevent creeping featurism!


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Pgui-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/pgui-devel

Reply via email to