SimpleHTML datatype and dynamic content loading

12 posts / 0 new
Last post
TSK
TSK's picture
Offline
Last seen: 1 week 3 days ago
Joined: 2011-06-28 02:06
SimpleHTML datatype and dynamic content loading

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.

  1. STRPTR HtmlPage=IUtility->ASPrintf("<html><head></head><body>empty</body></html>"); HtmlPageSize=44;
  2. //Example: HtmlPage=LoadFromNetwork(url); //HtmlPage=LoadFromFile(filename);
  3.  
  4. LAYOUT_AddChild,MainGads[MAIN_DISPLAY]=IDataTypes->NewDTObject(NULL, //"T:temp.html",
  5. DTA_DataType,HtmlDT,
  6. DTA_GroupID,0, //GID_TEXT,
  7. DTA_SourceType,DTST_MEMORY,
  8. DTA_SourceAddress,HtmlPage,DTA_SourceSize,HtmlPageSize,
  9. GA_ID,MAIN_DISPLAY,
  10. GA_Immediate,TRUE,
  11. TAG_DONE),
  12. CHILD_DataType,TRUE,
  13. CHILD_NoDispose,TRUE;
  14.  
  15. struct DataType *HtmlDT=IDataTypes->ObtainDataType(DTST_MEMORY,HtmlPage,
  16. DTA_GroupID,0,
  17. DTA_SourceType,DTST_MEMORY,
  18. DTA_SourceAddress,HtmlPage,DTA_SourceSize,HtmlPageSize,
  19. TAG_DONE);
  20.  
  21. IDataTypes->SetDTAttrs(MainGads[MAIN_DISPLAY],MainWindow,NULL,
  22. DTA_DataType,HtmlDT,
  23. DTA_GroupID,0, //GID_TEXT,
  24. DTA_SourceType,DTST_MEMORY,
  25. DTA_SourceAddress,HtmlPage,DTA_SourceSize,HtmlPageSize,
  26. TAG_DONE);
trixie
trixie's picture
Offline
Last seen: 2 weeks 2 days ago
Joined: 2011-02-03 13:58
Re: SimpleHTML datatype and dynamic content loading

@TSK

But trying to remove it and adding it back to layout gadget (BOOPSI GUI) makes the software to crash.

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?

SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition Author of WordNet for OS4
TSK
TSK's picture
Offline
Last seen: 1 week 3 days ago
Joined: 2011-06-28 02:06
Re: SimpleHTML datatype and dynamic content loading

What I left out from the code is this:

  1. CHILD_DataType,TRUE,
  2. CHILD_NoDispose,TRUE,
salass00
salass00's picture
Offline
Last seen: 21 hours 57 min ago
Joined: 2011-02-03 11:27
Re: SimpleHTML datatype and dynamic content loading

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.

TSK
TSK's picture
Offline
Last seen: 1 week 3 days ago
Joined: 2011-06-28 02:06
Re: SimpleHTML datatype and dynamic content loading

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 ?

trixie
trixie's picture
Offline
Last seen: 2 weeks 2 days ago
Joined: 2011-02-03 13:58
Re: SimpleHTML datatype and dynamic content loading

@TSK

or datatypes system is outdated ?

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.

SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition Author of WordNet for OS4
TSK
TSK's picture
Offline
Last seen: 1 week 3 days ago
Joined: 2011-06-28 02:06
Re: SimpleHTML datatype and dynamic content loading

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.

TSK
TSK's picture
Offline
Last seen: 1 week 3 days ago
Joined: 2011-06-28 02:06
Re: SimpleHTML datatype and dynamic content loading

@salass00

Using the tags DTA_DataType, DTA_GroupID, DTA_SourceType, DTA_SourceAddress and DTA_SourceSize with SetDTAttrs() is incorrect and will not do anything meaningful.

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.)

thomas
thomas's picture
Offline
Last seen: 1 week 3 days ago
Joined: 2011-05-16 14:23
Re: SimpleHTML datatype and dynamic content loading

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.

TSK
TSK's picture
Offline
Last seen: 1 week 3 days ago
Joined: 2011-06-28 02:06
Re: SimpleHTML datatype and dynamic content loading

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).

whose
whose's picture
Offline
Last seen: 1 week 4 days ago
Joined: 2011-08-09 02:25
Re: SimpleHTML datatype and dynamic content loading

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.

Coder Insane-Software www.insane-software.de
TSK
TSK's picture
Offline
Last seen: 1 week 3 days ago
Joined: 2011-06-28 02:06
Re: SimpleHTML datatype and dynamic content loading

@whose
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.

Log in or register to post comments