I am using Virtual TreeView. It seems that Virtual TreeView will automatically update the node check state when its children check states are changed. Is there a way to prevent this?
Thanks
Related
I am using Virtual TreeView. In my understanding, since the whole treeview is virtual, the node properties(including the check state) are set on request(such as on a OnData event handler) instead of storing together with the node, since the node is total virtual. However, it seems that Virtual TreeView will store the check state of the node together with the node, instead of obtain from external data source and set on request.
Why?
Use the OnBeforeGetCheckState event to handle this in a more virtual manner. The OnChecking and OnChecked event might also be helpful.
Is there a way to tell if a treeview node is currently in edit mode?
I'm using the KeyUp event to determine if the delete key was hit - I only want to fire off my 'do you really want to delete this' code if the user is NOT editing.
This project is using Delphi 2010.
You can ask the TTreeView.IsEditing property. From the reference:
Indicates whether a node is currently being edited by the user.
IsEditing returns true if any node label in the tree view is being
edited.
I have a form with a grid with data and some db controls (DBEdit for instance).
When user types inside the DBEdit, Delphi automatically set the record in edit mode. But I dont like this, I want to be able to edit a record only if I programmatically call Table.Edit;
any idea how to prevent this? of course without setting the edit control read-only. I mean a workaround in the data aware components (table) directly.
Set the AutoEdit property of your datasource to false.
DBNavigator provides a nbEdit Button.
Look up TDataSource.AutoEdit property.
I use Delphi XE3 and DevExpress ExpressEditors Library 12.2.4.
I have a form with several DevExpress editors (TcxTextEdit, TcxLookupCombobox, TcxImageComboBox, TcxMemo and TcxPopupEdit among others). Many of these editors (but not all) have a repositoryitem. I need to set some of these editors to readonly. If i do this
Edit1.Properties.ReadOnly := true;
it will not work if the editor has a repositoryitem, since the repositoryitems value will override the editors properties. If I do this
Edit1.ActiveProperties.ReadOnly := true;
this will actually change the repositoryitem, so all editors based on the same repositoryitem will also be readonly.
One solution I tried was to assign the repositoryitems properties to the editors properties before showing the form, and set the repositoryitem to nil. This worked fine for the ReadOnly property, but had the side effect that this also set the editor events to the repositoryitems events. Many of the editors on the form has events, so I couldn't use this solution. One solution to this would be to manually reset the OnXXX-properties after clearing the repositoryitem, but I also have a few editors that have events both on the editor and on the associated repositoryitem.
How do I set the readonly property of some of the editors, but not on other editors that use the same repositoryitem? I would love a solution that worked on all properties, but for now ReadOnly is most important.
I hope I understood your question.
As far as I know there are two ways.
Handle the ShowingEditor event and using e.Cancel if this is supposed to be read only.
Create two repository items, one set to ReadOnly, and assign them to the different controls respectively.
I am working in video application in my application am using many controls for user friendly first i will Load the base from only after that i ll load the other controls based on user need.... here my need is if user load ten controls in this case if he shutdown the machine means when he restart the machine i need to bring the all controls back what he was load the controls before he shutdown. thanks in advance
is there is any possible to achive this without store the current control set, and positions etc..
You need to look at something like
Form and Control Position and Size
Utility
Save and restore Form position and
layout with this component
Basically what it boils down to, is that you need a way to store the current control set, and positions (possibly values too) to some sort of storage (XML file, Registry, Database) when the user exits your form/application.
Then once they reopen the form/application, you need to retrieve these settings for the given user (if any is available) and restore the form/application to that state.
How about making extension methods to Control class?
(Actually, appropriate .NET abstract base class, a sub-class of Control class, depending on UI. Do you use Windows Forms or XAML or ASP.NET?)
Something like:
public static class MyPositionExtensions{
public static void SaveState(this Control c){ /* Save position to xml-file */ }
public static void RestoreState(this Control c){ /* Load from xml-file */ }
}
Then in your closing just loop like
foreach(var c in MyControls)c.SaveState();
and opening like
foreach(var c in MyControls)c.RestoreState();