1. PictureButton background color
- Posted by Jonas Temple <jktemple at yhti.net> Sep 12, 2002
- 366 views
Hey all, I've got an app where I create picture buttons using xpm: -- First set the transparent color setTransparentColor( getSysColor( COLOR_BTNFACE ) ) -- Now create the dibs for use with our toolbar dib1 = createDIB( xpmToEuBmp( preferences_xpm ) ) dib2 = createDIB( xpmToEuBmp( print_xpm ) ) dib3 = createDIB( xpmToEuBmp( search_xpm ) ) dib4 = createDIB( xpmToEuBmp( clock_run_xpm) ) dib5 = createDIB( xpmToEuBmp( stop_xpm ) ) dib6 = createDIB( xpmToEuBmp( exit_xpm ) ) dib7 = createDIB( xpmToEuBmp( help_xpm ) ) dib8 = createDIB( xpmToEuBmp( connect_xpm ) ) dib9 = createDIB( xpmToEuBmp( disconnect_xpm ) ) When the user changes the system's color settings the background of the button doesn't change. Do I have to recreate the bitmap with the new background color and then user setBitmap to update the background color? Maybe I've answered my own question? Thanks, Jonas
2. Re: PictureButton background color
- Posted by Derek Parnell <ddparnell at bigpond.com> Sep 12, 2002
- 373 views
Jonas, when the bitmap is drawn with transparency, the background at the time of drawing is shown instead of the designated transparency color. This is a once-off thing. It does not automatically get redrawn if the background is altered. What you have to do is recreate the button images whenever the background is altered. 12/09/2002 11:16:54 PM, Jonas Temple <jktemple at yhti.net> wrote: > >Hey all, > >I've got an app where I create picture buttons using xpm: > >-- First set the transparent color >setTransparentColor( getSysColor( COLOR_BTNFACE ) ) >-- Now create the dibs for use with our toolbar >dib1 = createDIB( xpmToEuBmp( preferences_xpm ) ) >dib2 = createDIB( xpmToEuBmp( print_xpm ) ) >dib3 = createDIB( xpmToEuBmp( search_xpm ) ) >dib4 = createDIB( xpmToEuBmp( clock_run_xpm) ) >dib5 = createDIB( xpmToEuBmp( stop_xpm ) ) >dib6 = createDIB( xpmToEuBmp( exit_xpm ) ) >dib7 = createDIB( xpmToEuBmp( help_xpm ) ) >dib8 = createDIB( xpmToEuBmp( connect_xpm ) ) >dib9 = createDIB( xpmToEuBmp( disconnect_xpm ) ) > >When the user changes the system's color settings the background of the >button doesn't change. Do I have to recreate the bitmap with the new >background color and then user setBitmap to update the background color? > Maybe I've answered my own question? > >Thanks, > >Jonas > > > > --------- Cheers, Derek Parnell ICQ# 7647806
3. Re: PictureButton background color
- Posted by Ron Tarrant <rtarrant at sympatico.ca> Sep 13, 2002
- 359 views
Derek Parnell wrote: > > Yes, delete the bitmap then recreate it. Use the deleteObject(hBMP) call. Does this apply to other types of objects? For instance, if TextEdit objects are deleted during the running of an app, do they need to be deleteObject()'ed to free resources? Forgive me if this is a really 'low level' question; I don't know very much about MS Windows programming yet. -Ron T.
4. Re: PictureButton background color
- Posted by Derek Parnell <ddparnell at bigpond.com> Sep 13, 2002
- 381 views
Ron, this is a good question. The general process is that if you are finished with something, you should delete it. The exception is that everything gets automatically deleted when the app finishes. So, normally you don't have to worry about explicitly deleting anything. The question about bitmaps here was with the situation where a given bitmap was finished with before the applicaiton had finished. So in that case you should delete the bitmap. ---------------- cheers, Derek Parnell ----- Original Message ----- From: "Ron Tarrant" <rtarrant at sympatico.ca> To: "EUforum" <EUforum at topica.com> Sent: Friday, September 13, 2002 5:12 PM Subject: Re: PictureButton background color > > Derek Parnell wrote: > > > > Yes, delete the bitmap then recreate it. Use the deleteObject(hBMP) call. > > Does this apply to other types of objects? For instance, if TextEdit > objects are deleted during the running of an app, do they need to be > deleteObject()'ed to free resources? > > Forgive me if this is a really 'low level' question; I don't know very > much about MS Windows programming yet. > > -Ron T. > > > >