Is there a way to change content in SimpleHTML DT (Aeon version or the original one) on the fly ? If I save html content to file and then create a new object with NewDTObject("filename"...) then the object displays html fine. But trying to remove it and adding it back to layout gadget (BOOPSI GUI) makes the software to crash. Trying to create the object without any filename and trying to change the content with DTST_MEMORY doesn't display any changes. Is there a way to force datatypes to use a certain datatype ? I tried to create/obtain a struct Datatype but that didn't help.
- STRPTR HtmlPage=IUtility->ASPrintf("<html><head></head><body>empty</body></html>"); HtmlPageSize=44;
- //Example: HtmlPage=LoadFromNetwork(url); //HtmlPage=LoadFromFile(filename);
- LAYOUT_AddChild,MainGads[MAIN_DISPLAY]=IDataTypes->NewDTObject(NULL, //"T:temp.html",
- DTA_GroupID,0, //GID_TEXT,
- struct DataType *HtmlDT=IDataTypes->ObtainDataType(DTST_MEMORY,HtmlPage,
- DTA_GroupID,0, //GID_TEXT,
Removing an object from a layout (through LAYOUT_RemoveChild or the safer LM_REMOVECHILD method) will dispose of the object, so you cannot possibly add it back because it no longer exists. Are you sure your crash is not caused by you adding an object that has already been disposed of?
What I left out from the code is this:
If you want to display another html file you should dispose the old datatype object and create a new one with NewDTObject().
Using the tags DTA_DataType, DTA_GroupID, DTA_SourceType, DTA_SourceAddress and DTA_SourceSize with SetDTAttrs() is incorrect and will not do anything meaningful.
You mean SimpleHTML doesn't support that or datatypes system is outdated ? I hope Aeon can add new features to SimpleHTML.
Can you tell me how to remove and add a new datatype object to an open window without crashing the OS ? Should I use OpenWindowTags window instead of window class window ?
While it may not be the actual cause of your problem, the datatypes subsystem certainly is outdated. It's a technological reflection of a past world where data and media types were less complex than today's ones.
I didn't expect SimpleHTML being able to display all HTML content. I was trying something as curiosity. Loading jpeg picture into memory and telling jpeg datatype to get it from there it displays the picture fine. I was expecting other datatypes being able to do the same as general feature.
I hope SimpleHTML will support those tags in future. Otherwise it's pretty meaningless. It shouldn't matter who loads the data into memory. (All data have to be loaded into memory before it can be accessed in any case.)
That's illogical. You cannot change the class of an object after the object has been created. You cannot tell a picture class to be a sound or something. If you want to change the type of data you have to dispose the object and create a new one.
I'm not changing any class or anything else. If I want to feed HTML text into HTML datatype I can't see any problem there (to put it mildly).
thomas meant the tags "DTA_DataType, DTA_GroupID". It´s not logical to change these, because a sound datatype couldn´t display an image (or text) and vice versa.
The current datatype system is a little bit outdated, because it is (yet) unable to change its contents dynamically (aka the "complexity" of "modern" data that Trixie mentioned. But this is not about complexity, it is much more about pushing "dynamic" content even if the dynamic is not needed for the specific content at all. E.g. the APNG format, which is meant for still images BUT also for animations, in the same context. So, if you have THE ideal software to display still images you´re forced to support animations, too, even if your software is optimized just for still image display. Hence I would call it "artificial complexity" instead, sometimes hidden behind the term "portable").
That´s why you should dispose a finished datatype object and allocate a new one, if you want to change the contents of your datatype object.
Now I understood a little bit better. I was testing too many things if they could make a difference. Unfortunately adding and removing objects to an already open window has been problematic always. So somebody have to create similar BOOPSI gadget class because they can display dynamic content. But our community is too small to make it worthwhile.