MUI: How to change Bitmap in MUI Bitmap?

3 posts / 0 new
Last post
Spirantho
Spirantho's picture
Offline
Last seen: 9 years 12 months ago
Joined: 2013-03-19 12:12
MUI: How to change Bitmap in MUI Bitmap?

Hi everybody,

I have a large number of bitmaps (all the same bitmap data) which I want to change the source bitmap of on the fly.
When I change the MUIA_Bitmap_Bitmap at the moment, nothing happens until I iconify and bring back the window - at which point it all looks correct.

How can I force MUI to change the bitmap source data safely and cleanly?

I think I may need to make a subclass but I'm not sure how to do this with a Bitmap class and make it able to use the standard MUI bitmap class but redraw it on demand.

Can anyone help?

Thanks!

Spirantho
Spirantho's picture
Offline
Last seen: 9 years 12 months ago
Joined: 2013-03-19 12:12
I was given the solution on

I was given the solution on another forum. I've attached it here to help other people with the same problem.
Apparently a note is going to be added to the AutoDocs. :)
=====

tboeckel Posted on: 3/19 16:10
You will have to take a little detour to enforce the necessary relayout of the bitmap object. Take this object definition for example:

grp = HGroup,
Child, bm = BitmapObject,
MUIA_Bitmap_Bitmap, initialbitmap,
...
End,
End;

To set a new bitmap do this:
if(DoMethod(grp, MUIM_Group_InitChange))
{
DoMethod(grp, OM_REMMEMBER, bm);
SetAttrs(bm, MUIA_Bitmap_Bitmap, newbitmap, ..., TAG_DONE);
DoMethod(grp, OM_ADDMEMBER, bm);
DoMethod(grp, MUIM_Group_ExitChange);
}

The relayout is enforced by removing and readding the bitmap object.

zzd10h
zzd10h's picture
Offline
Last seen: 6 years 5 months ago
Joined: 2012-08-24 20:56
Hi Spirantho, I'm playing

Hi Spirantho,
I'm playing too with MUI Bitmap, but contrary to you, I don't have problem to update my Bitmap but my program (and the OS) freezes when I deiconify my program.
Do you do something special to prepare the deiconification of your Bitmap ?
When I remove it, in iconification phase with REMMEMBER, and not readd it during deiconification, it works.

I have tried the InitCHange, ExitChange method, but it freezes, when I do the following in the deiconification

if (DoMethod(redrawGroupe, MUIM_Group_InitChange))
{
DoMethod(redrawGroupe, OM_REMMEMBER, Im_Data_bmp);
DoMethod(redrawGroupe, OM_REMMEMBER, rect2);
DoMethod(redrawGroupe, OM_REMMEMBER, STR_EnCours_Label);
DoMethod(redrawGroupe, OM_REMMEMBER, boutonGroupe);
SetAttrs(Im_Data_bmp, MUIA_Bitmap_Width, 300,MUIA_Bitmap_Height, 225, MUIA_Bitmap_Bitmap, bitmap_vignette, TAG_DONE);
DoMethod(redrawGroupe, OM_ADDMEMBER, Im_Data_bmp);
DoMethod(redrawGroupe, OM_ADDMEMBER, rect2);
DoMethod(redrawGroupe, OM_ADDMEMBER, STR_EnCours_Label);
DoMethod(redrawGroupe, OM_ADDMEMBER, boutonGroupe);
DoMethod(redrawGroupe, MUIM_Group_ExitChange);
}

I tried with or without the SetAttrs => KO
I tried without REMMEMER ADDMEMBER of Im_Data_bmp => no freeze (but no Bitmap)

Thank for your help

I have crossposted in your thread on Amigans...

Log in or register to post comments