Hi, With MUI, I have a problem with DTPic. I want to change the DTPic file when user press a element of a list. It works at init time. It works when the first element is selected (the DTpic loads well the file) But it doesn't work when a new element is selected.
At init, I use Child, Im_Data_png = DtpicObject, MUIA_Dtpic_Name, "PROGDIR:NoPreview.PNG", End,
In my code, when I select an element,
set(Im_Data_png,MUIA_Dtpic_Name, path_preview);
the DTPic load just the image for the first time and never updated it at subsequents attempts.
The link you provided already proves that this stuff is implemented since 2 years now.
Changing the image of a Dtpic object definitely works, I just checked it myself with both MUI 3.9 and MUI 4.0. I took the Class1 demo source and just added these few lines:
set(Im_Data_png,MUIA_Dtpic_Name, path_skin_preview); set(Im_Data_png,MUIA_Dtpic_Name, path_skin_preview); it doesn't work
But when I do this with a first constant filename set(Im_Data_png,MUIA_Dtpic_Name, "PROGDIR:Skins/Empty.png"); set(Im_Data_png,MUIA_Dtpic_Name, path_preview);
it works, Im_Data_png show the right png file :)
Of course, path_preview contains always the correct path of the png.
If this is true, then DTPic might internally keep the pointer to the file name and if you set the same pointer a second time, it thinks the image didn't change and thus doesn't update the display.
If this is true, then DTPic might internally keep the pointer to the file name and if you set the same pointer a second time, it thinks the image didn't change and thus doesn't update the display.
That's true. Dtpic.mui just remembers the string pointer passed to MUIA_Dtpic_Name and does NOT copy the string. Second, during OM_SET it will check if the pointer changes first. Third, NULL is no valid value for MUIA_Dtpic_Name.
Since the string pointer is remembered you must use a different buffer to change the image. Something like this will NOT work: