OptionButton Property Disable - vba

I have an option group or "frame", and inside I have 4 buttons (Option Buttons).
They are called:
opt_mtto
opt_elec
opt_qlty
opt_complete
So I was selecting the property of each button to Enable = False, so when my form load they will be Disabled. But, I didn't to be coding each button to enable each of the buttons, I though.. why wouldn't be better to say to the frame to be disable, so all inside would be disable.
So instead of going for each button, I return to my properties and enabled them again, but I disable my frame, so this made the same way, but only with 1 click .
But I got a problem, when I click a button I want my frame get enabled so I code:
frame01.enabled = True
(This enabled all my buttons..)
But I only want 1 button Disable, in this case:
opt_mtto.enabled = false
so my code is:
frame01.enabled = true
opt_mtto.enabled = false
and this get me an error: 2101: "The setting you entered isn't valid for this property".
So I made this the other way, I enabled my frame, and then call the option button to be disable, and it works...
I only want to know why, I can't do this, the first way I mention.
I repeat is:
When Form_Load the property are already set to the frame as False (no CODE, is set manually, in properties)
When click button, enable Frame,
Just after of enable the frame, disable one of the buttons inside.
ERROR...
Why

Solution:
The frame was getting focus before disabled the button.
You can't disable controls if they are focus, this wasn't the same case, because the focus was on the frame, not in the button, but it happened the same way, I just needed to re-focus in other place.

Related

Having a problem with visual studio Databinding when leaving and coming back to the same form

For making this simply I have two forms a button on each to navigate between the two forms. Then on one I have a checkbox and label when the checkbox is checked it displays the label by using the following code in the form.load event:
Me.label1.DataBindings.Add("Visible", Me.checkbox1, "Checked")
The problem is if I were to leave the form with the checkbox and label and the checkbox is not checked and then I come back to the form with the checkbox and try and check it the label doesn't show up any suggestions or solutions.
Delete that line of code from the form load
Open your form in the designer, the one with the label and the checkbox on it
Click the checkbox
In the Properties grid expand (PropertyBinding) and open the drop down next to (none), click New at the bottom
Pick an initial value, and choose a name for the setting. Make it user scoped if you want to be able to save it and restore it next time the program opens
Now go to your label, properties, click the [...] next to (PropertyBinding) to see a list of all bindable properties, scroll to Visible and drop down to choose the same setting
Run the program.
Side note; when I did this I think I may have encountered a bug/feature of databinding (that I plan to research more) in that the behavior was only as expected if the bool starts out as true (so the control is visible) when the binding is set up. If the control is invisible, it never binds properly to see when the property has become true - so as a workaround (purely in this case where we're binding Visible), replace he call to InitializeComponent() with this, in the form's constructor:
if (!Properties.Settings.Default.FormatWithoutConfirmation)
{
Properties.Settings.Default.FormatWithoutConfirmation = true;
InitializeComponent();
Properties.Settings.Default.FormatWithoutConfirmation = false;
}
else
InitializeComponent();

How do I uniquely identify enabled/disabled objects in QTP

In my application, I have to verify if a particular button is enabled or not. It gets enabled after I fill in certain values.
But, the problem is the properties for the button is EXACTLY the same when its enabled and disabled. (Even the value of isEnabled is false in both cases)
If I try to click on that button, it gets clicked in both cases (even it gets clicked when its disabled but however since its disabled nothing happens)
So, how do I proceed now?
Are you sure all the properties are exactly same? Do you have access to the color property? Font color or background color. If yes, then I am sure color for enabled and disabled button would be different. If this is the case- viola!
You can check the height and width of the object to identify the object .
Mostly in masked scenario it will be zero .
Well, if the button is disabled, then clicking it will yield no result. If this is for a web-based application, then you can include a checkpoint in your code to check that no request/response is sent from the webpage. (ie. no communication is initiated from the browser).

How can I remove windows right click menu?

I have a group of text boxes within my form. Whenever I right click on them or the panel they are in, I get this menu:
I want to remove this menu from showing, and leave the right click to be nothing. However, the mouseclick event never fires for any of these. Therefore, I am having trouble getting rid of it. It usually shows up when my text is highlighted.
Is there a way to remove it? Or am I looking in the wrong event?
Another option is to set the ShortcutsEnabled Property of the TextBoxes to False:
Use the ShortcutsEnabled property to enable or disable the
following shortcut key combinations and the control’s shortcut
menu
This disables the keyboard shortcuts as well; not sure if that is applicable to your scenario.

DevExpress VerticalGrid Validate event and behavior with RadioButton cell editors

I'm using the VerticalGrid in MultiRecordView. Its Validate event fires when the grid detects that a record that has been changed is losing focus. I'm writing data to the database from this event.
My users want to use the keyboard left/right arrow keys to move forwards and backwards through the recordset, so I trap those keys and set the FocusedRecord accordingly.
If one of the row editors is a RepositoryItemRadioButton, the Validate event doesn't always fire. The users will click on the radio-button value desired and then, before they click on another row in the record, they'll hit the arrow key to move to the next record. The change to the radio button group has not been detected by the grid in that sequence of events.
The radio button change is detected only when the button loses focus.
Is there a way to cause the vertical grid to recognize that a radio button editor has been changed and fire the Validate event, if the user doesn't give another row in the record the focus?
I thought EditValueChangedFiringMode property controlled that behavior, but setting it to Default or to Buffered does not have the desired effect.
Thanks

VB.NET-Grid double click fires on single click

Ok, here is a weird VB.NET Grid problem. I am sure it is really simple, but it doesn't make sense to me.
I have a grid that displays data from a binding source. I have a method to handle the CellContentDoubleClick which will get the value of the cell and use that to do a new look up. This will generate a new datasource (with different columns) which I then rebind to the grid.
My grid double click works, but when it repaints with the new data, a single click fires the double click. This happens whether or not thre is a single click handler.
The interesting thing is that it is (in my case) a toggle. If I double click, on the repaint, a single click fires the double click code. When it repaints again, I need a double click.
The double click code fires off a messagebox - if I tell it not to continue, then I have to double click to get it to fire again. So it is not dependant on what data is displayed.
When it is in the mode to respond to a single click, I can tab through all the controls and then click on any cell in the grid and it will still fire the double click.
No matter what I try to do (set focus to other controls, refresh the grid, etc.) nothing seems to reset the grid so it works consistently.
Any ideas?
Ok, I found the answer. The data grid (at least in VS.Net 2007) has a property named "EditMode". If that is set to EditOnEnter (NOT the default) then you will experience this behavior. If you reset it (or change it to EditOnKeystrokeOrF2) then the datagrid will work as you expect (no single clicks acting like double clicks.)
This is after testing with threads, subclassed grids, you name it... I should have reviewed the property settings first.... grumble....