How to lock selected nodes in TVirtualStringTree? - locking

I have a TVirtualStringTree with some checked nodes. After processing, some of those nodes are selected by the application for future use with double-click.
My problem is that after the application select some of those nodes, if any node is clicked or double clicked, the selection is lost. I need that only the application can make selection changes; and those selections must stay selected while still needed.
Is there someway to lock the selection to the user? I tried set the property
TreeOptions.MiscOptions.ReadOnly ← True
but it cause errors on the component.
I looked at SelectionOptions property but could not find a subproperty to resolve my problem.

After more and more tests I've found a property that solved my problem. 'SelectionLocked' isn't a public property and I didn't knew about it until now. If you set it to 'false' one can't select or desselect anything in the 'StringTreeView' until you set it back to true.

Related

Checkbox component presents different behavior for different users

I have a Windows Form application with a checkbox that presents different behaviour according to the user. The component appears in the form only for the user who installed first the application.
For other users that have the same privileges, in the same machine, the checkbox is not visible. I already tried to uninstall and reinstall the application with different users, but the problem persists.
In my code, there´s nothing that changes the Visible property to true or false, I just let the default value to true
Appreciate any help, thanks!
Try resize the window that contains the checkbox. You are probably setting the size or the location of the checkbox in a wrong way. Try to use proper anchor property and see if the problem resolves.

Event Structure Not Working Twice

My event structure in the following part of my VI will work when I start up the program, but never again until I stop and restart. I figure I'm not doing something simple, can someone help?
The event structure is in a while loop. Again, it works once, but not after that...
You have set Enable Beeper Value change action. It will occur once you change the value of the button from the front panel, or change the value trough property node with signaling. Changing value using a local variable or property node value property will not cause Event Handler to register the event.
It seems to me your case structure is fine.
When you press "enable beeper" the event structure should execute the case you have shown and enter the case structure in the True frame.
When you press the button again, the event structure should be executed again this time processing the False frame of the case structure.
(I assume, since you have a local variable, that "enable beeper" is not latched).
If this is what you want to happen but not what's happening the issue could be somewhere else.
Is the Read from Visa function working properly? Could it be waiting for a reply from the hardware?

How do I tell if any values have changed for NSUserDefaultsController sharedUserDefaultsController

I have a typical case of implementing a preference panel for my application, but I've run into a problem with detecting changes to any preference values. In my case I don't want to apply changes automatically so I've set
[[NSUserDefaultsController sharedUserDefaultsController] setAppliesImmediately:NO];
I've also bound all my controls in my preference panel to sharedUserDefaultsController.
And then I have a Cancel and a Apply button in my preference panel, and I want to only enable the Apply button if any changes had been made to the sharedUserDefaultsController values.
So I thought I could bind hasUnappliedChanges of my sharedUserDefaultsController to my Apply buttons enable property. But hasUnappliedChanges only return true, even if no changes have been made. Or actually it returns false as long as I do not load my preference panel window. But as soon as the window is loaded and it reaches awakeFromNib, hasUnappliedChanges returns true. And from there on I can't get it to reset back to false. Doesn't matter if I save the sharedUserDefaultsController.
So my questions are:
How do you properly detect if any values of sharedUserDefaultsController has changed?
And does hasUnappliedChanges work when you bind your controls to sharedUserDefaultsController?
Appreciate any help I can get.
Edit
I tried observing NSUserDefaultsDidChangeNotification, but that only post an update after a value is saved to the user defaults. In other words, after I call
[(NSUserDefaultsController*)[NSUserDefaultsController sharedUserDefaultsController] save:sender];
So unless I'm using this wrong way that wont work as far as I can tell.

How do I re add a control that lost it's parent groupbox?

Problem I recently had a form with buttons, radiobuttons, etc within a group box. I deleted the groupbox, but kept it's contents. Unfortunately, now whenever I'm in the designer editing, and I move one of those controls, I get this error:
"Value cannot be null. Parameter Name: child."
So, From what I could tell from some searching is that one of the parameters is set to NULL. In this case it is the child/parent parameter of the control.
Question How do I reset this parameter? I didn't see it shown in the properties nor the designer.cs.
What I've tried
I tried one of the radio button sets by deleting and creating new ones in the form. This caused the two radio buttons go into stack overflow, for when I click one it tries to NOT the value of the other, and the other does the same. This creates a sort of infinite loop.
Any suggestions?

How would you make a checkbox in a Outline View become checked when all it's children's checkbox's are checked?

How would you make a checkbox which is on a parents/groups row in an outline view become checked when all it's children's checkbox's are checked. But when only some are checked display a line. Here is an example of what I'm talking about:
alt text http://snapplr.com/snap/042v
Whenever you check a box, check to see if all its siblings are checked. If so, check the parent. (And run the check again on that level.)
To do that... well, your NSOutlineView has a data source, right? Something that's telling it what to display? Well, in the method called by the checkbox when it's clicked (whatever you set that up to be), get the parent object behind the row which was clicked, and then update its status. If you don't have a direct reference to the checkbox from the model, you can use -[NSOutlineView parentForItem:] to find it.
Hopefully that gives you enough to get started. If it doesn't, then you'll need to ask a more specific question, detailing exactly which parts you're having trouble with.