disabling navigation keys for xamNumericEditor using properties - xaml

Is there any property to disable UP/Down keys that are incrementing/decrementing the xamNumericEditor value using any property of numericeditor?

If you set the SpinIncrement property to 0 the up/down arrow keys will not affect the value of the editor.

Related

Modify properties for individual controls in the details section of a form in continuous forms view

I have a form with a default view set to continuous forms. I want to set the enabled property of a command button control to disabled for records that have a null value in a specific column.
Short answer, you can't. What you need to do is start the button routine with an IF statement that says if the required control is null then exit sub. That way the button won't do anything if the field has a null value
Try setting the caption in the Detail_Paint event for the form:
cb_SetSpecies.Caption = [Species_Name]
This allows a different value to be set for each record.

Set UltraGrid to ReadOnly property, vb.net

In my project, I have a form that has 3 radio buttons, an ultragrid, and a textbox. When I load the form, I want the ultragrid to be ReadOnly, or the equivalent of this, and then I want it to become active again when rbCategory is checked (one of the radiobuttons). I then need it to be set to ReadOnly again if one of the other 2 radio buttons are selected.
I feel like ReadOnly is not a property that can be used with Ultragrids, so what is the equivalent (to make it grey, like a ReadOnly textbox, basically), and how is this coded?
I tried using
ugCategories.DisplayLayout.Override.AllowUpdate = DefaultableBoolean.False
but this didn't seem to do the job
By setting AllowUpdate you are actually making the grid read-only. If you need to change the grid appearance you need to set appearance for the read-only cells like this:
ugCategories.DisplayLayout.Override.ReadOnlyCellAppearance.BackColor = Color.Gray;
Further, you may consider set and the CellClickAction to CellSelect like this:
ugCategories.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.CellSelect;
You may also check this article for more helpful information from Mike Saltzman - Infragistics Win Forms Guru

Property Default Value does not work for a new control

I have a custom user control which expands and collapses. I have to have a second "open width" property that has to be set separately from the normal width property.
When I collapse the control, it makes the width 10. When I expand the control, it returns the control width back to the "open width" property, which has to be manually set to the normal width when the control is created.
The default new width on the control is 200, so for consistency I want to set the default "open width" property to 200 as well. So I have the following:
Private _mSideBarOpenWidth As Integer
<EditorBrowsable(EditorBrowsableState.Always)>
<Browsable(True)>
<DesignerSerializationVisibility( _
DesignerSerializationVisibility.Visible)>
<DefaultValue(200)>
<Category("SideBar")>
<Description("Sets the open Width of the SideBar control.")>
Public Property SideBarOpenWidth() As Integer
Get
Return _mSideBarOpenWidth
End Get
Set(value As Integer)
_mSideBarOpenWidth = value
End Set
End Property
When I drag a new control onto the form the default value is always 0. If I change it the value does persist, it just will not start at 200. I have done quite a bit of searching on this issue and I have tried the following:
cleaning/building/rebuilding the project
closing VisualStudio and opening it back up
deleting the form and creating a new one
using the control in a new project
setting <em>DesignerSerializationVisibility.Visible</em> to <em>.Content</em>
using <em>"200"</em> with the quotes as the default value
And various combinations of all those. None of that works and the default value on a new control dragged onto the form goes to zero. Needless to say I am at a loss on why the default value will not get set to 200 when it is created.
The only time I am even accessing the property is when I am setting the width of the control Me.Width = SideBarOpenWidth
it just will not start at 200
That is not what DefaultValue does. VS uses the DefaultValue to determine whether or not the current value differs from the default and so, should be serialized and show the property value in Bold in the Property IDE. It doesn't set the value. A remark from MSDN:
A DefaultValueAttribute will not cause a member to be automatically initialized with the attribute's value. You must set the initial value in your code.
Attributes provide information about a class, property etc. Your property doesnt know about the DefaultValue attribute and they don't interact without code you add.
Instead, they specify information about the class or property (etc) to other things (designers, serializers etc). For instance, which Editor or TypeConverter to use. A good example is the Description or Category attributes - these provide information about your properties to VS which it uses in the Properties pane in the IDE.

key Equiv. for nsbutton is not working properly for multiple nsbuttons

I have two nsbuttons in my interface builder.For all of these three nsbuttons I have set Key Equilant to "Return" key.And also I set nextkey view to all of these buttons.
I have 3 different actions for all of these three buttons and connections has made properly.
If I use mouse click appropriate actions are getting executed.
After running the Application,initially my first button has focus,presses return key, 1st button's action is executed.Next I pressed tab key,focussed has changed to 2nd button,pressed return key but 1st button's action is executed.Again I pressed tab key,focussed has changed to 3rd button,pressed return key still 1st button's action is executed.
What I am missing here.Why the appropiate action is not happenning on pressing Return key over nsbutton even focus is highlighted.
It sounds like you're using keyboard navigation to switch between buttons and activate the selected one. In that case, the Return key would normally correspond to pressing the selected button. However, since you've assigned Return as a shortcut for one or more of the buttons, the responder chain searches for and finds a button with a matching key equivalent, so that button's message is sent instead.
Try clearing the key equivalent for all three of your buttons. I think that'll give the behavior you're looking for.
If you're not using keyboard navigation, it's not clear why the tab button has any effect. Nevertheless, if you're trying to do something like make the default button cycle from one button to the next, you'll need to change the keyboard equivalent each time a button is pressed. I wouldn't recommend that generally -- I don't think users would like to have the default button change from one moment to the next. If you must though, here's some code:
- (IBAction)nextButton:(NSButton*)sender
{
int tag = [sender tag];
NSView *superview = [sender superview];
if ([sender.keyEquivalent isEqualToString:#"\r"]) {
NSButton *nextButton = [superview viewWithTag:(tag % 3) + 1];
nextButton.keyEquivalent = #"\r";
sender.keyEquivalent = #"";
}
}
This assumes that you've got three buttons, and each is configured with the nextButton: method as its action. Also, the buttons have tags 1, 2, and 3 respectively. The idea here is that when the default button (i.e. the one with the return key as its equivalent) is selected, it sets the next button's key equivalent to Return and sets its own equivalent to nothing.
You can obviously change the way the code works -- you may want each button to call a different action, for example. In that case, just have each action call a common method that does the same job as the code above.
The lesson here is that if you set the same key equivalent for several buttons, the first one to be found will be "pressed". If you want the key equivalent to change, you need to change the equivalent set for your various buttons.
I'm not sure what you mean about the focus changing when you press the tab key -- I don't see this behavior (I've set up the initial first responder and next key connections). All three buttons are blue, but only the first one pulsates, no matter what keys I press. After experimenting a bit, I found that the button that is at the top of the list (in the window's object list) is the one whose action is performed on clicking return.
I can't find any documentation on this, but I don't think you can set the same key equivalent for multiple buttons in the same window.

CheckedListBox VB.Net MultiExtended SelectionMode

I have a CheckedListBox with a few items and I want to allow user to select more than one using arrows keys or mouse clicks combined with shift and ctrl keys so I set SelectionMode property to MultiExtended.
In design time it is not possible I get an error:
value property is not valid.
and if I set it in runtime by doing:
clbEmployees.SelectionMode = SelectionMode.MultiSimple
I get an error too:
CheckedListBox is not compatible with multiple selection.
How could I do this?
It's not supported for the CheckedListBox.
However, I'm fairly sure that you could mimic that functionality in a ListView. Just look at the CheckBoxes and MultiSelect properties of the Listview. As far as I can tell from the documenation those are compatible.
This might be too late, but I just put my solution here; Works perfect for me:
1- Just leave the CheckedListBox Selection mode as "ONE' in property sheet.
2- in your code, loop thru the checked item in your checked Box using the checked item property as following:
For each XX as 'DataTpe' in CheckedListBox.CheckedItems
'Here you assign each checked item to wherever you want to direct to'
Next