REALGetPropValue* for Enumeration?

Hi,

someone knows how to read an enumeration property?

REALGetPropValueInteger doesn’t seem to work for me.

e.g. read TextUnit property in Graphics class.

Try using the other one to read int32 maybe…

Int32, Int64, UInt64, UInt32 and Integer all fail here.
@William Yu, can you check in framework code if one of the function supports enums?

Christian Schmitz did you ever figure this out? Reading and writing to an enumerating type using the plugin seems to crash my code.

Do you use latest SDK with the newer function to query property getter/setter?

See REALGetClassProperty function.

Okay I’ll take a look at that.

It looks like the version I’m using doesn’t have REALGetClassProperty - but we’re also still building on Xojo 2017 R3. It looks like that’s very new, as I don’t even see it in the plugin SDK included with 2019 1.1?

REALGetClassProperty was introduced in 2019r2, however the API itself is backwards compatible so you could use the Plugins SDK shipped with 2019r2 and build a plugin that uses REALGetClassProperty safely with 2017r3.
Having said that, REALGetPropValue/REALSetPropValue for enumerations was fixed in 2019r2 so if you are able to use your plugin with 2019r2 or later it should work fine.

Ah, okay. I’ll give that a shot then.

I grabbed the code from the plugins SDK in 2019r3.1 and now running my test program crashes on compiling. I’m going to try using 2019r2.

Tried 2019r2 as well, and the compile fails / crashes still.

To be clear, the crash is in Xojo itself when I compile my test application after switching the SDK code.

Hmmm, I can only speculate what the issue could be without seeing what your plugin code looks like. I would at least try one of the examples that ship with the Plugins SDK to be sure those are working for you.

Okay, I’ll check the included plugins and see what happens

Okay, it appears to be a conflict with some other plugins we have. I can deal with that later. I’ve got it running so now if I want to set an enumeration do I have to use REALGetClassProperty or should I be able to use REALSetPropValueInteger? Or should I be using a different data type? This is for a 64-bit build, BTW.

If you use REALGetClassProperty, you don’t need REALSetPropValueInteger as you call setter directly.
Works well for us.

And the signature for the pointer is something like:

void (*MyPropSetter)(REALobject instance, RBInteger value);

Is that right? And the index of the property to be extracted - is that just the value of the property as listed in the declaration (second in the list of properties, so index 1) or is there some way to determine that at runtime?

I answered the index part myself - I was correct and see that the declaration part that comes back matches to the property I was expecting. I’m going to try out my setter and see if that works.