Hi!
According to the article of Trixie at OS4Coding.net one should use no more reaction_macros.h and use using OpenClass()ed class pointers for creating Reaction objects instead. I managed to transform my current project to the 'new' style but I found one problem: I have generated several windows with page.gadget functionality (combined with clicktab.gadget, for example). But if I create the page with
IIntuition->NewObject(LayoutClass,NULL,TAG_DONE)
and add pages to this gadget with PAGE_Add, these pages are not displayed. But pages work as they should if I use
Intuition->NewObject(ILayout->PAGE_GetClass(),NULL,TAG_DONE)
How one should use LayoutClass in this situation?
Marko
Using 'page.gadget' with IIntuition->NewObject(LayoutClass..
Re: Using 'page.gadget' with IIntuition->NewObject(LayoutCla
There is some example code on how to do this at http://wiki.amigaos.net/index.php/ReAct ... d_Disposal
There are a few cases where a class pointer is not available and you need to use the class name instead. See http://wiki.amigaos.net/index.php/BOOPS ... SI_Classes to figure out which classes are in which files.
For example, intuition.library contains several classes which must be accessed by name. The page.gadget is another case because it is contained within the layout.gadget file.
The "GetClass()" idea was introduced back when there was no way to reliably get the Class pointer.
There is an argument regarding speed because when you search by name it takes a bit of time. However, I find that argument very weak unless you are creating thousands of objects and looking up the name each time. Even in that case you can take the Object pointer and get back to the Class pointer so really you only need to find by name once. But I digress.
There are a few cases where a class pointer is not available and you need to use the class name instead. See http://wiki.amigaos.net/index.php/BOOPS ... SI_Classes to figure out which classes are in which files.
For example, intuition.library contains several classes which must be accessed by name. The page.gadget is another case because it is contained within the layout.gadget file.
The "GetClass()" idea was introduced back when there was no way to reliably get the Class pointer.
There is an argument regarding speed because when you search by name it takes a bit of time. However, I find that argument very weak unless you are creating thousands of objects and looking up the name each time. Even in that case you can take the Object pointer and get back to the Class pointer so really you only need to find by name once. But I digress.

ExecSG Team Lead
Re: Using 'page.gadget' with IIntuition->NewObject(LayoutCla
Ok, thanks, these were good links with good explanations. I understand I shouldn't use the GetClass() here even if still works but the access by name is the way to go here?ssolie wrote:There is some example code on how to do this at http://wiki.amigaos.net/index.php/ReAct ... d_Disposal
...which must be accessed by name. The page.gadget is another case because it is contained within the layout.gadget file.
The "GetClass()" idea was introduced back when there was no way to reliably get the Class pointer.
...
Marko
Marko
Re: Using 'page.gadget' with IIntuition->NewObject(LayoutCla
@blmara
As the Page Gadget is embedded in Layout Gadget, you should access it via the public class name, as Steven suggests:
The first argument to NewObject() is the class pointer, which you cannot obtain in this particular case because you cannot OpenClass() a gadget that is embedded in another gadget. So you must pass a NULL class pointer and use the public class name instead, which goes in the second argument.
As the Page Gadget is embedded in Layout Gadget, you should access it via the public class name, as Steven suggests:
Code: Select all
Object *myPageObject = IIntuition->NewObject(NULL, "page.gadget", ... , TAG_DONE)
The Rear Window blog
AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition