Jump to content

Best way to determine whether a class will override method


Recommended Posts

No it's not about scripting. 

I want to create a plugin class hierarchy and have a generic config GUI. If a class overrides a specific method I will enable a button that allows to open a class specific config GUI.

 

I don't think I make the assumption of the path relationship between the method and the class.

 

Ton

Link to comment

Ah right, there's no path assumption. I still think a class qualified with a library name would cause issue though?

 

Maybe using a traditional dynamic dispatch method to query the class to see if it supports the option?

Link to comment

I can use the OpenG function 'Class name'  to find the qualified name of the class.

Since I will run this on the default value it will most likely not cost a lot of resources.

Questioning the class via a method is a maintenance nightmare for the class creator.

 

Ton

Link to comment

Dunno, sounds like somethings a bit awry with your object hierarchy if you need to be manually checking for overrides.....

 

Havie you tried handing off the UI to the actual class?  That way they can automatically show the correct GUI.  Hint: Subpanels.

 

Shane.

Link to comment
I want to create a plugin class hierarchy and have a generic config GUI. If a class overrides a specific method I will enable a button that allows to open a class specific config GUI.

Would it be better to have a “ConfigGUI” object that was recursive (contained an optional subConfigGUI)?  Have a “Get ConfigGUI” method that has a “subConfigGUI” input.  The parent implementation would initialize the generic GUI and add the inputted subConfig GUI.  Child implementations could override the method to initialize a specific GUI and pass this in to the parent method.  The “display” (or whatever) method of the ConfigGUI object would enable the button if a non-default subConfigGUI was present.  That avoids any class introspection.  It would also work at any depth (so your more specific GUIs could themselves have even more specific sub-GUIs).

Link to comment

How about giving the class a method called "Get Editor GUI" that returns a VI refnum, and if it returns Not A Refnum then it has no special GUI and if it returns a refnum then you run that GUI? In other words, instead of overriding the editor VI directly, override the accessor VI for that GUI.

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.