[Gambas-user] IDE code questions - property editors
Benoît Minisini
gambas at ...1...
Wed Oct 7 01:50:04 CEST 2015
Le 06/10/2015 06:37, adamnt42 at ...626... a écrit :
> I think this is way out there in the cosmos somewhere, but I'll ask
> anyway.
>
> I am wading through the FProperty code of the IDE trying to
> understand how the values for properties are set (bad term) in the
> grid. When I get down to CControl.GetProperty(sProp As String) I see
> the following (with annotations):
>
> Try hProp = Project.Documentation.Classes[Kind].Properties[sProp]
>
> If hProp Then If hProp.AlwaysRead Then <--- Question1
>
> vVal = Object.GetProperty(Control, sProp) <---- Question 2
>
> ...
>
> Endif Endif
>
> Return $cValue[sProp] <---- Question 3
>
> 1) I see that these are set in the CPropertyInfo class but why are
> some properties AlwaysRead?
Because property values are cached, and the real property value may
change without the cache seeing it.
For example, the value of a RadioButton, that may change if another
RadioButton is set.
>
> 2) This is messy. If a control is a custom control then it appears
> that this line tries to get the property value from the object whose
> class name is the _DrawWith constant defined in the custom control
> not the actual control class?
The IDE can only display controls that comes from components it uses.
For controls of other components, it relies on the _DrawWith property
that tells him which control to use instead. Of course, that control
must be in one the components used by the IDE.
>
> 3) I dont understand how the $cValue array is initialised nor indeed
> what its' intent is. Could you enlighten me?
It's the collection that caches the value of the control property.
It's not necessarily the real value, but the value you see in the
property editor. For example, the Background property of a control is an
integer, but a String for the IDE.
>
> Why all this?
>
> I am trying to modify the IDE so that the property editor can use
> special popup editor forms for some extra-special property types for
> custom controls. In short, the goal is to have the property editor
> form inside the custom control component rather than in the IDE. A
> "visible" example is the AngleBox class control "txtAngle" in the
> current IDE. I believe this is only used(?) for the report controls.
> Because we have a bunch of custom controls that have some
> extra-special properties, I have to continually maintain the IDE code
> updates because of svn differences and conflicts.
>
> So, I have so far managed to make a minimal set of mods that allows
> the (local) IDE to recognize custom properties (i.e. the
> extra-special ones) and use a pop-up editor that is contained within
> the custom control component. The pic attached is an example to
> explain it better .. (1) is a custom control, in that control I have
> a property
>
> (2) "Options" that has a custom editor. When I click on the "..."
> button the popup editor shown appears.
>
> and when the Save button is clicked the property "value" is saved
> where I want it. All well and groovy.
>
> In summary, I think this would be a good IDE enhancement. i.e. moving
> the editor for custom control extra-special properties from inside
> the IDE to within the custom control component itself. So...
>
> tia bruce
>
The IDE can't use code located in other components, because he will have
to load them, which is not always possible. So the code that "manages"
special properties can't be inside the components.
So I put them directly in the IDE. It's not nice, but it's not a
problem, because the IDE is always released with the entire Gambas
development stack, so you can ensure that everything is synced.
Now the IDE source code should be better organized if you and other want
to develop custom dialogs for special properties.
If you want to have custom dialogs associated with custom components,
I'm afraid it's not possible at the moment.
What is needed is:
- A way to have a gambas library side by side with a component, that
would include the custom dialogs.
- A way for the IDE to load these libraries automatically at runtime.
- A way for the IDE to unload a library. This is not technically
possible, the interpreter being unable to do that.
And you forgot to attach your image.
Regards,
--
Benoît Minisini
More information about the User
mailing list