PDA

View Full Version : Variable visibility



Xarxus
January 6th, 2023, 13:17
I'm trying to add functions to the combobox handling defined in CoreRPG. I defined a template, based on combobox tag, to which I added a script.
From what I see I can override a function with a new one, calling the CoreRPG one using "super.[function name]".
It's not clear to me if I can do the same with variables.
Is there any way by new code to access the value of (for example) _bActive defined in the CoreRPG code?

Trenloe
January 6th, 2023, 15:09
Any variables that are defined as local can only be accessed in the script scope where they are defined. You can't use super._bActive as _bActive is defined as local

Xarxus
January 6th, 2023, 15:29
Sigh, so the only way is not layering and rewrite all

superteddy57
January 6th, 2023, 15:45
Most of those controls are in a state where a rewrite is the goal since the control has a very specific purpose through the rulesets that use it. Ones that can be expanded usually have a get function that will retrieve certain local variables. I have played with this template quite a bit and expanding it might be better served with a whole new template to your specific use. What is the use of your custom combobox?

Xarxus
January 6th, 2023, 17:27
There are two things I would like to address.
The first is the ability to distinguish equal values ​​with different keys (for example two professions with the same name coming from different modules). The second aspect is the graphic one: I'd like to be able to change the appearance depending on whether it's selected or not, or whether it's readonly. I would like to be able to intervene also on the appearance of the list without having to have a specific control for each occasion (color of the frame, font, etc.)
But I already know that by rewriting it, other needs will come to mind.

If you have any suggestions, please let me know. For example, do you know if there is any other code I should study?