@LyleHaze
Since there are no other responses, I searched my collection of sourcecode examples and only found one file where GetScreenMode() is used. However, the only way I was able to access those sources was by cloning the repository with OS4 "Sgit". Assuming you have OS4 Sgit installed you should be able to checkout the Netsurf sources by changing directories to an empty one and enter in a shell:
Be sure you have your shell window expanded to full width or the download will take too long.
Once the dowload is completed you should look in netsurf/frontends/amiga/gui_options.c for some code that may help you.
Thanks to you both.
I was unable to retrieve the source from the first reply, but the second one hooked me right up.
And it is GetScreenMode.gadget. You are correct.
It LOOKS like what I am doing should work. the screenmode gadget is rendered, and I get the proper message when it is pressed. But the IDoMethod() fails. No screenmode request opens..
I'm sure it's something simple, now more than ever. I will keep at it.
thanks again to you both for your help. At least I know what it should look like. :)
Outstanding!
And it arrives at the start of my weekend. :)
after removing some "stray \240"s that were inserted by the web site, it works great.
Thank You. I appreciate the assist. And now this stands as example for others too.
Follow Up: Most intereting. The example worked the first time(s) I tried, but could not open the window after a fresh reboot. I ran Odyssey, then ran the example again, no window. I ran Score, then ran the example, it works again. So it is depending on _something_ to be loaded already. I'll not bother digging any deeper.
It's a great help, and since I already have a current copy of Score, I'll not have any troubles with it at all! :)
Follow-Up:
My "IDoMethod()" call was not right.
I now have a working screen requester, and tomorrow I'll add screen opening and prefs stuff to support it.
Again, my thanks for the help!
Follow Up: Most intereting. The example worked the first time(s) I tried, but could not open the window after a fresh reboot. I ran Odyssey, then ran the example again, no window. I ran Score, then ran the example, it works again. So it is depending on _something_ to be loaded already. I'll not bother digging any deeper.
I retested "layout" and had the same problem. I think I found the problem but I can't find any way to edit my post with the example.
If I add the definition:
The getscreenmode_gc.doc autodoc states this:
GETSCREENMODE_GetClass
This function is deprecated as of V52.
Use the "getscreenmode.gadget" public class ID instead.
When I used "getscreenmode.gadget" it only worked when certain other programs were running. All I can say is WTF.
At least you got your program working, which was the point of this topic.
When I used "getscreenmode.gadget" it only worked when certain other programs were running. All I can say is WTF.
That's because your program doesn't open the gadgets/getscreenmode.gadget library before trying to use it.
If before running your program you run another program that does correctly open this library then your program will "work" but only by luck. If you were to quit the other program and something caused the class library to be expunged then your program would crash.
Using -lauto doesn't help in this case because your code does not reference GetScreenModeBase or IGetScreenMode anywhere so the relevant constructor/destructor code from libauto won't be linked in.
You can force the libauto code to be linked in by adding something like:
if(GetScreenModeBase == NULL){
/* The code should never get here */
return20;
}
to the beginning of your main() function, but I recommend using IIntuition->OpenClass() and passing the class pointer directly to NewObject() instead as this is more efficient.
For myself, I have "canned" code to open/close libraries/interfaces, classes, and all the common stuff, so I just added getscreenmode.gadget to the list. I understand that libauto is really convenient, but I am old-school, and prefer a bit more control over what's getting opened and how.
And it's working nicely. When screens are opened by Score, they look a bit rough, but the getscreenmode gadget is working fine and I'm sure the rest is just about using the right tags.
@salass00
Thanks for the info. However, I think the autodocs need updating to replace the recommendation to use something like "getscreenmode.gadget" or "getfont.gadget" with the method you stated. It might also be nice to update include/include_h/reaction/reaction.h to include missing classes like diffview.
@LyleHaze
Since there are no other responses, I searched my collection of sourcecode examples and only found one file where GetScreenMode() is used. However, the only way I was able to access those sources was by cloning the repository with OS4 "Sgit". Assuming you have OS4 Sgit installed you should be able to checkout the Netsurf sources by changing directories to an empty one and enter in a shell:
sgit clone git://git.netsurf-browser.org/netsurf.git netsurf
Be sure you have your shell window expanded to full width or the download will take too long.
Once the dowload is completed you should look in netsurf/frontends/amiga/gui_options.c for some code that may help you.
X1000 - OS 4.1FE
You can also access the repository online:
frontends/amiga/gui_options.c
But it's using the getscreenmode.gadget and I didn't find a GetScreenMode() function (in the OS4 SDK)?
Thanks to you both.
I was unable to retrieve the source from the first reply, but the second one hooked me right up.
And it is GetScreenMode.gadget. You are correct.
It LOOKS like what I am doing should work. the screenmode gadget is rendered, and I get the proper message when it is pressed. But the IDoMethod() fails. No screenmode request opens..
I'm sure it's something simple, now more than ever. I will keep at it.
thanks again to you both for your help. At least I know what it should look like. :)
LyleHaze
@LyleHaze
I copied the GetScreenMode.gadget into some simple reaction example source with some modifications and I got a requester to pop up:
X1000 - OS 4.1FE
Outstanding!
And it arrives at the start of my weekend. :)
after removing some "stray \240"s that were inserted by the web site, it works great.
Thank You. I appreciate the assist. And now this stands as example for others too.
Follow Up: Most intereting. The example worked the first time(s) I tried, but could not open the window after a fresh reboot. I ran Odyssey, then ran the example again, no window. I ran Score, then ran the example, it works again. So it is depending on _something_ to be loaded already. I'll not bother digging any deeper.
It's a great help, and since I already have a current copy of Score, I'll not have any troubles with it at all! :)
LyleHaze
Follow-Up:
My "IDoMethod()" call was not right.
I now have a working screen requester, and tomorrow I'll add screen opening and prefs stuff to support it.
Again, my thanks for the help!
LyleHaze
@LyleHaze
I retested "layout" and had the same problem. I think I found the problem but I can't find any way to edit my post with the example.
If I add the definition:
#define GetScreenModeClass IGetScreenMode->GETSCREENMODE_GetClass()
and change the line:
LAYOUT_AddChild, objects[OID_SCREENMODE] = IIntuition->NewObject(NULL, "getscreenmode.gadget",
to the line:
LAYOUT_AddChild, objects[OID_SCREENMODE] = IIntuition->NewObject(GetScreenModeClass, NULL,
then the program seems to always work.
The getscreenmode_gc.doc autodoc states this:
GETSCREENMODE_GetClass
This function is deprecated as of V52.
Use the "getscreenmode.gadget" public class ID instead.
When I used "getscreenmode.gadget" it only worked when certain other programs were running. All I can say is WTF.
At least you got your program working, which was the point of this topic.
X1000 - OS 4.1FE
That's because your program doesn't open the gadgets/getscreenmode.gadget library before trying to use it.
If before running your program you run another program that does correctly open this library then your program will "work" but only by luck. If you were to quit the other program and something caused the class library to be expunged then your program would crash.
Using -lauto doesn't help in this case because your code does not reference GetScreenModeBase or IGetScreenMode anywhere so the relevant constructor/destructor code from libauto won't be linked in.
You can force the libauto code to be linked in by adding something like:
to the beginning of your main() function, but I recommend using IIntuition->OpenClass() and passing the class pointer directly to NewObject() instead as this is more efficient.
For myself, I have "canned" code to open/close libraries/interfaces, classes, and all the common stuff, so I just added getscreenmode.gadget to the list. I understand that libauto is really convenient, but I am old-school, and prefer a bit more control over what's getting opened and how.
And it's working nicely. When screens are opened by Score, they look a bit rough, but the getscreenmode gadget is working fine and I'm sure the rest is just about using the right tags.
LyleHaze
@salass00
Thanks for the info. However, I think the autodocs need updating to replace the recommendation to use something like "getscreenmode.gadget" or "getfont.gadget" with the method you stated. It might also be nice to update include/include_h/reaction/reaction.h to include missing classes like diffview.
X1000 - OS 4.1FE