-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Derive class that simplifies handling of data for cells in grid #799
Comments
Thanks for the patch. It however looks a bit strange to me to have a new property Please send patches as in the patch or diff file format, our Wiki describes how to create them. This makes it easier to apply the patch to any version, and you cannot forget a line like in this case. In case we accept this patch, we should consider to add it on the level of |
Why don't you just iterate over the selected nodes in your multi-value edit dialog? You can already get an array of selected nodes. Is there really a need to further complicate an already overly complex component? |
@joachimmarder @pyscripter The changes to VST doesn't make the component much more complicated. They only gives the user the option to handle data the same way as he does with string values. |
While this is true it heads the components one step further in the wrong direction by coupling model and view tighter than necessary, which especially will lead newbies to a bad architecture. |
No, as the path (events, functions) are already in the component. If not, it would be impossible, to edit a value within the VST. I've only added the same events/functions, that works with pointers, instead of strings. I don't see, where i'm coupling model and view tighter, as it already is. |
Ok..found some time :) I've forked the project, and do the changes within the fork. This way, i can do a pull request for the changes. Hope this is ok ? |
As said before, i do not see, where i'm coupling model and view tighter. The View already do know nothing about the userdata within the node. The only change is, that the Editor response to changes on the data (and the editor should know, what kind of data has to be edited) using pointer instead of a string. |
I'm sorry, but I still do not see the point in piping the data of a control that is designed based on the virtual paradigm through the control. Because the idea of the virtual paradigm is that the controls knows nothing about the data, the controls is supposed to do callbacks to the data. Any other comments on this matter from other users? |
Maybe I missed something. I see a new OnGetData event, but it is not used anywhere in the control. Who is firing this event and who is consuming it? If both is the application or form, what is the point in piping the data through the control?
Yes, of course, the editor is data model specific, it needs to know the data model, but it does not need to know the VirtualStringTree control. Especially it should not use the control to get access to the data model, this should be injected in constructors or through properties. |
As the onGetText event, the onGetData event is fired within the GetData Method, which in turn is used in the value property. To be clear, we are talking about inplace editors :) (like the standard one, that is already implemented) Maybe a example clears some points :) Think about the Objectinspector of Delphi. In our example, at the Font-Property. Handling the subproperties can be done, using the normal Text, as most of the real data can be converted to a string. But the main property (in this case an Object-Instance) is not that easy. So, the editor (or to be exact, the editorlink), has to know this instance to feed the editorcontrol/editordialog with the proper data. In turn, the application must be informed, when it's data needs to be updated. Its pretty much the same way, normal Strings are handle. |
But neither
It needs to know the instance of the data model, but it does not need to know the control. It should receive a reference to the data model through constructor injection or through a property.
No. |
The editorlink needs to know both, the VST, as the VST calls the methods of the editorlink. The editorlink also need to know the editcontrol, as it has to position, display the control, and also feed the editcontrol with the proper data, that needs to be edited. It also needs to transport the edited data (whatever this might be) back to the application. In normal circumstances, the editlink uses the Text-property of the VST, to do this and as long as you have simple data, this is fine. When it became to more complex data, it's impossible to use the Text-Property. |
But the editor does not need to use the control to read from and write to the data model. The editor may interact with the control for UI purposes. |
Just to add a few information, we have our own component derived from
Where the data type is an enum like this:
and the XXValue events are using a Variant to get the appropriate value from the user code. I'm not sure this should be put in the base class, but it's not that difficult to implement in a derived one. |
We could add such a derived class (e.g. a The advantage is that the base does not get any more complex but the code is available to all users. |
I've did something similar for grid and editors. The fact that everyone has to make its own wheel makes me sad. +1 for adding this component to VTV package (at least as Contribution) |
I'm working currently on a kind of Objectinspector, like the one Delphi has. To do so, i've create a lot of "Editors" for the VST, including some, that calls Dialogs, to edit multiple items using a Dialog (for example: The font property of a Label). For this i need to exchange more data between the vst and the editor, so i've done a little enhancement, to exchange pointers instead of a string.
The changes i made, are marked with Beginpatch/Endpatch within the source attached.
patched_VirtualTrees.zip
Would be greate, if this make it to regulare VST 😄
The text was updated successfully, but these errors were encountered: