Could anyone possibly share a piece of code for reading the system gui.prefs? I specifically need to obtain the "System requester opening position" and "Evenly sized system requester buttons" settings from the Options tab in GUI preferences. Any help greatly appreciated!
Tue, 2016-01-05 12:42
#1
Reading system gui.prefs
Don't try to interpret the gui.prefs file directly.
If you have to know the settings for some reason you should use GetGUIAttrs() instead.
The tags GUIA_EvenRequesterButtons and GUIA_RequestersPosition should get you the information you want.
@salass00
Oh great, I didn't know there was a function; you never stop learning. Thanks very much!
I do, I'm developing a BOOPSI class that had better respect these particular system-wide GUI settings.
AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2
@salass00
There, however, seems to be a problem.
The GetGuiAttrs() autodoc specifically says that you can use a NULL DrawInfo parameter in this function to obtain "the global GUI preferences of Intuition". But when I do
both values are always 0, regardless of what I have set in the system GUI prefs editor. I need to LockPubScreen() the default public screen, then GetScreenDrawInfo() from it, and pass it to GetGUIAttrs() to obtain proper values. A workaround, but far from what the autodoc says.
AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2
GUI settings can be set on a per-screen basis by the user so you should always supply a DrawInfo if possible.
I would also suggest obtaining the values only as and when they are needed, like in your equivalent of RM_OPENREQ if you're doing a requester class.
Maybe the global GUI prefs or the default pubscreen prefs are not the best ones to use anyway. There are utilities that let the user change the default public screen. There are also Workbench replacement systems (like Dopus5) that might not be honoring the global GUI prefs. As salass00 points out, GUI prefs can be set on a per-screen basis. You might want to consider getting and using the DrawInfo for the screen that your class will be used on. That way the GUI settings for your class will be constistant with system requesters opening on that screen. You may need to experiment with various screens (default pubscreen, Workbench screen, current screen) to determine which is best.
As usual, something that seems simple at first can get complicated :-)
X1000 - OS 4.1FE
@salass00
Done!
@xenic
Done! Thank you both for your suggestions.
AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2