Hi Philipp,

Philipp Lohmann a écrit :
You can probably skip the mask color (unless your PNG files actually contain magenta where the mask should be). Nowadays png files with alpha mask work just fine.

Noticed.

Indeed, I used the same code, and it works, but not completely. The
problem I got, is only one image is shown, means only the one initialized in 
the Ctor.

The way you describe it you created two buttons where you wanted to have one button and two images. I'd use one ImageButton and set the apropriate image on it when changing state.

So as resource have

Image IMAGE_PADLOCK_OPEN
{
 ImageBitmap = Bitmap
 {
  File = "Padlock1_open.png";
 };
};

Image IMAGE_PADLOCK_CLOSED
{
 ImageBitmap = Bitmap
 {
  File = "Padlock1_closed.png";
 };
};

ImageButton BTN_PADLOCK
{
 Pos = MAP_APPFONT ( (COL_3 + COL_4 )/2 + 5, ROW_3 - 20 ) ;
 Size = MAP_APPFONT ( 16 , 16 ) ;
 TabStop = TRUE ;
 QuickHelpText [ en-US ] = "Click to lock" ;
 QuickHelpText [ fr ] = "Cliquer pour verrouiller" ;
};

and then use SetModeImage to set the image on the one button, when t changes state.

Many thanks for the tip. Unfortunaly, it does not work. The reason why I used two buttons is that I need two different QuickHelpText (one per status), but I can change with fixed text and Show() Hide() or something similar. I thought Hide() Show() works well. Just the images do not show.

Nevertheless, I think I have fully understood how to create the layout, and my main problem seems to be the use of the two images, maybe the initialization or something silly I forgot.

To tell you more, the better I had, was the button appearing at the beginning, and once I clicked, it disappeared, or was hidden (I don't know exactly). Was with my first (wrong) attempt.

To save your time, I'll continue to search, but maybe you could just remind me the normal list of things to be done ?

for example, is it mandatory to check/set the state of the buttons ?

I did :
aPadlockImageButton.SetClickHdl( LINK( this, OfaTreeOptionsDialog, PadlockHdl_Impl ) );

in InitTreeAndHandler(), plus simply Show/Hide() when neede, but maybe that's not enough ?


- shall I create and instantiate 2 ImageButton and Hide() / Show() them
instead of just loadImage() them ?


Possible, but not necessary.

That's the current work in progress, but it does not work either : no image is shown at all, but the buttons work perfectly using Show(), Hide(), and the QuickHelp texts work perfectly too. Just the missing images ..


- is there a method I missed to change the image with the new one
locking, unlocking the padlock ?


Possibly call Invalidate() after changing the image on the button; I'd expect that not to be necessary, but am not sure.

Tested without success either.

Certainly something simple I missed :/


Kind regards,
Eric

--
Education Project:
http://wiki.services.openoffice.org/wiki/Education_Project
Projet OOo4Kids : http://wiki.ooo4kids.org/index.php/Main_Page
L'association EducOOo : http://www.educoo.org
Blog : http://eric.bachard.free.fr/news

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@gsl.openoffice.org
For additional commands, e-mail: dev-h...@gsl.openoffice.org

Reply via email to