Hi, using:
...
LAYOUT_AddChild, OBJ(OBJ_RADIO) = IIntuition->NewObject(NULL, "radiobutton.gadget",
...
fails to "auto"open such gadget, all others gadgets do fine (getscreenmode.gadget suffers same problem).
If I add code to create the classpointer, even without using it in source, program works fine.
RadiobuttonBase = IIntuition->OpenClass("gadgets/radiobutton.gadget", 52, &RadiobuttonClass);
System needs to not having radiobutton.gadget already in memory loaded.
Is it a problem in radiobutton (and getscreenmode) includes?
radiobutton.gadget doesn't load/open
- javierdlr
- Beta Tester
- Posts: 389
- Joined: Sun Jun 19, 2011 10:13 pm
- Location: Donostia (GUIPUZCOA) - Spain
- Contact:
radiobutton.gadget doesn't load/open
- Attachments
-
- radiobutton.zip
- (2.16 KiB) Downloaded 277 times
Re: radiobutton.gadget doesn't load/open
gradientslider has the same problem.
Workbench Explorer - A better way to browse drawers
- colinw
- AmigaOS Core Developer
- Posts: 207
- Joined: Mon Aug 15, 2011 9:20 am
- Location: Brisbane, QLD. Australia.
Re: radiobutton.gadget doesn't load/open
The classes/gadgets are loaded by ramlib.kmod when the subsystem calls Iexec->OpenLibrary(), just like
any library. So if it is a disk based library/gadget, it needs to be in one of the official paths to be found,
the default paths can be overridded by an absolute path, by specifying a path with a colon in it,
eg: "sys:classes/gadgets/radiobutton.gadget", or, "classes:gadgets/radiobutton.gadget", using the dedicated
assignment, however the default paths that ramlib will search in, for libraries/gadgets are as follows (in order);
"LIBS:", "CLASSES:", "CURRDIR:", "CURRDIR:Libs", "CURRDIR:Classes", "PROGDIR:", "PROGDIR:Libs", "PROGDIR:Classes"
So, if you want the default search path to find it, then "CLASSES:" is the default public path, you will need
to specify the subdirectory for the complete path, or it will not work. eg: "gadgets/radiobutton.gadget"
Unless of course it was already loaded in memory by something else previously and hasn't been flushed yet.
Please review the ramlib.doc, it has all this information.
any library. So if it is a disk based library/gadget, it needs to be in one of the official paths to be found,
the default paths can be overridded by an absolute path, by specifying a path with a colon in it,
eg: "sys:classes/gadgets/radiobutton.gadget", or, "classes:gadgets/radiobutton.gadget", using the dedicated
assignment, however the default paths that ramlib will search in, for libraries/gadgets are as follows (in order);
"LIBS:", "CLASSES:", "CURRDIR:", "CURRDIR:Libs", "CURRDIR:Classes", "PROGDIR:", "PROGDIR:Libs", "PROGDIR:Classes"
So, if you want the default search path to find it, then "CLASSES:" is the default public path, you will need
to specify the subdirectory for the complete path, or it will not work. eg: "gadgets/radiobutton.gadget"
Unless of course it was already loaded in memory by something else previously and hasn't been flushed yet.
Please review the ramlib.doc, it has all this information.
- thomasrapp
- Posts: 310
- Joined: Sat Jun 18, 2011 11:22 pm
Re: radiobutton.gadget doesn't load/open
I don't think that NewObject opens a class if it is not yet loaded and I don't think that NewObject("path/name") will succeed.
You always have to load required resources before you can use them. So OpenClass or OpenLibrary("gadgets/something.gadget") is needed in any case before you can use NewObject, no matter whether you use the class pointer or the public name of the class. Only after the class has been loaded into memory it is known as a public class.
You always have to load required resources before you can use them. So OpenClass or OpenLibrary("gadgets/something.gadget") is needed in any case before you can use NewObject, no matter whether you use the class pointer or the public name of the class. Only after the class has been loaded into memory it is known as a public class.
Re: radiobutton.gadget doesn't load/open
@javierdlr
Are you using the -lauto switch? I think some common BOOPSI classes are loaded and opened by libauto for you automatically. This is why you may be experiencing that certain gadgets don't seem to need opening, while others do.
Are you using the -lauto switch? I think some common BOOPSI classes are loaded and opened by libauto for you automatically. This is why you may be experiencing that certain gadgets don't seem to need opening, while others do.
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
- broadblues
- AmigaOS Core Developer
- Posts: 600
- Joined: Sat Jun 18, 2011 2:40 am
- Location: Portsmouth, UK
- Contact:
Re: radiobutton.gadget doesn't load/open
Yes indeed, you must open the classlibrary for any gadget you want to use and **must not** rely on some other application having opened first, if all other applications close the library it could get expunged leaving you up a creek without a dispatcher!
For new code by preference use OpenClass() but OpenLibrary will do too.
Sometimes you can 'get away with it' fotr while until your program is the first to be started and suddenly it can't find it's classes on the public list. This happened to me with the UCLogic tablet driver GUI, as I managed to forget to open one of the more common ones, might have been button.gadget! Then when I needed to test from the no startup-sequnce shell it wouldn't work!
For new code by preference use OpenClass() but OpenLibrary will do too.
Sometimes you can 'get away with it' fotr while until your program is the first to be started and suddenly it can't find it's classes on the public list. This happened to me with the UCLogic tablet driver GUI, as I managed to forget to open one of the more common ones, might have been button.gadget! Then when I needed to test from the no startup-sequnce shell it wouldn't work!
- colinw
- AmigaOS Core Developer
- Posts: 207
- Joined: Mon Aug 15, 2011 9:20 am
- Location: Brisbane, QLD. Australia.
Re: radiobutton.gadget doesn't load/open
Sure, but there is never a need to call OpenLibrary() for a class/gadget yourself.broadblues wrote: For new code by preference use OpenClass() but OpenLibrary will do too.
The first line of code for Intuitions OpenClass() function, IS an internal call to exec OpenLibrary() function,
it just does some extra things afterwards.
So calling OpenClass() requires the same treatment as calling OpenLibrary() for ramlib to find the load file.
- javierdlr
- Beta Tester
- Posts: 389
- Joined: Sun Jun 19, 2011 10:13 pm
- Location: Donostia (GUIPUZCOA) - Spain
- Contact:
Re: radiobutton.gadget doesn't load/open
@trixie No I'm not using -lauto switch. Doesn't matter if I add such switch, such gadget isn't "preloaded".
@all THX I thought NewObject() looked on disk for such files, now I understand it more clear, will use class pointers. Thanks all.
@all THX I thought NewObject() looked on disk for such files, now I understand it more clear, will use class pointers. Thanks all.
Re: radiobutton.gadget doesn't load/open
@javierdlr
And for that same matter you have to open "window.class", "layout.gadget" and "button.gadget" (and all other classes & gadgets you want to use) explicitly as well. You only do so for "radiobutton.gadget".
Oldfart
And for that same matter you have to open "window.class", "layout.gadget" and "button.gadget" (and all other classes & gadgets you want to use) explicitly as well. You only do so for "radiobutton.gadget".
Oldfart
X5000, appears to be sick. Dismantled jan 1, 2024.
Dead MicroA1
A1200 in ElBox, c/w Blizzard '040 @ 50MHz + SCSI module, ZIV-board c/w (o.a.) cv64/3d + flickerdoubler + FastATA-ZIV + Lots of SCSI gear, sitting idle.
RaspBerry Pi 2B, 3B, 4B/4Gb, 4B/8Gb
OrangePi 5+ 8Gb
ACER Windows 10
Dead MicroA1
A1200 in ElBox, c/w Blizzard '040 @ 50MHz + SCSI module, ZIV-board c/w (o.a.) cv64/3d + flickerdoubler + FastATA-ZIV + Lots of SCSI gear, sitting idle.
RaspBerry Pi 2B, 3B, 4B/4Gb, 4B/8Gb
OrangePi 5+ 8Gb
ACER Windows 10
- javierdlr
- Beta Tester
- Posts: 389
- Joined: Sun Jun 19, 2011 10:13 pm
- Location: Donostia (GUIPUZCOA) - Spain
- Contact:
Re: radiobutton.gadget doesn't load/open
OldFart wrote:@javierdlr
And for that same matter you have to open "window.class", "layout.gadget" and "button.gadget" (and all other classes & gadgets you want to use) explicitly as well. You only do so for "radiobutton.gadget".
Oldfart
Yep, you're right. THX