[RESOLVED] Off the wall UI issue
I have a user requirement as follows:
1. I have a collection of 3 panels each panel contains one textbox. On load, one or all textboxes may contain default values. When a panel or textbox are 'selected' the panel turns from color a to color b to indicate the active panel.
So far so good.
2. If a user should not access a panel, the control can not be able to become active and focus should not be able to be set to the textbox.
Once again, just disable the panel... But then
3. When a panel is not selectable, the textbox must maintain its appearance. This is the problem area. They do not want the textbox to 'look' disabled because we have several individuals that are colorblind and need to be able to see the default text in the textbox. When a textbox is disabled the background greys and the text inside also becomes a shade of grey. We have users that can't differentiate between the two shades...
So then how do I stop a control from being selected while maintaining an enabled look? Any ideas?
Re: Off the wall UI issue
Set the Locked property of the textbox to True.
Re: Off the wall UI issue
Locked doesn't server that purpose in .NET. Locked only makes the control not movable or sizable. In the ole' VB6 days that would have been the answer. In fact the only reason I now know about the Lock functionality in .NET is because that was my first thought and when it didn't work as expected I hit MSDN.
Re: Off the wall UI issue
Also i should point out that in the requirement they mention textboxes but I suspect after this mornings user meeting that they are going to want all 'disabled' controls to look enabled.
Re: Off the wall UI issue
In that case, I would suggest using some kind of Boolean to indicate the state of the controls. You said
Quote:
Originally Posted by VBGuy
2. If a user should not access a panel, the control can not be able to become active and focus should not be able to be set to the textbox.
I don't know how you would define "not access a panel", but if a panel has not been accessed, and therefore, the controls should not be available, then set the NotAvailable boolean to true. With something like this in place for the textboxes you could do
Code:
If NotAvailable = True Then
e.Handles = True
Else
e.Handled = False
End If
In the textboxs KeyPress event. I believe that is equivalent to VB6's KeyAscii = 0
The same with the buttons. If NotAvaiable = True then issue an Exit Sub prior to running any code.
Would this work for you?
Re: Off the wall UI issue
Thanks, thats a start. I was just sitting here thinking maybe just create a custom textbox and override paint such that when disabled i actually draw a 'label' containing the textbox value.
Re: Off the wall UI issue
Well, you could go that route, but to me that seems like overkill when, possibly, a little ole boolean might do the trick.
Re: Off the wall UI issue
Your suggestion would work if it was just keystrokes I needed to stop but I even have to block the control from getting focus via mouse. I am beginning to think this is an unrealistic requirement...
Re: Off the wall UI issue
What is the issue with the control getting focus if they can't do anything to it or with it?
When these controls are alledgedly disabled, what on the form is still enabled? In other words, what is still "enabled" when these other controls are not?
Re: Off the wall UI issue
Place the textbox in a panel or groupbox as a child control. Then disable the panel or groupbox and the textbox will remain with the enabled look but will actually be completely disabled.
Re: Off the wall UI issue
Basically when the form loads there is a scrollable panel that contains a collection of usercontrols. Each usercontrol is made up of a panel, a label and textbox. The label contains (for lack of a better explaination) an instruction or step. Based on the scenario, the user is 'guided' through the steps, not 1 through 5 but 1 then 3 then 4 then 2 then 5 for example. The business group only wants the current step to be 'active'.
For them active means enabled and the control panel back color set to a color other than 'control' so that it stands out. It also means that while step 3 is active, no other step can be active and the textbox associated with that step disabled. After performing step 3 and entering some text into the step 3 textbox, step three becomes inactive and step 4 becomes the active question (based on the above 1,3,4,2,5 path). At this point they need to see the data in step 3 but under no circumstance can they re-select the textbox control in step 3.
If it weren't for the colorblind issue, disabling the controls would work just fine. That is the only fly in the ointment right now.
Re: Off the wall UI issue
Quote:
Originally Posted by RobDog888
Place the textbox in a panel or groupbox as a child control. Then disable the panel or groupbox and the textbox will remain with the enabled look but will actually be completely disabled.
It sounds like that is what he is doing, but it doesn't seem to be acceptable to his users (for some odd reason)
Re: Off the wall UI issue
No, another panel for each textbox that needs to preserve this look. ;)
Re: Off the wall UI issue
RobDog888, disabling the container disables the controls. I tried both a panel and a group box. In both cases the textbox disables when it's parent container is disabled.
Re: Off the wall UI issue
Isnt that what you asked for? Not selectable and no color changes.
A single panel with a single textbox inside it and all of those in you r main panel.
Re: Off the wall UI issue
You can also create a global boolean (or several depending on your need). In the textbox's GotFocus event, if the boolean is false then set focus to another control that is enabled. This allows the textbox to remain readable but not highlightable.
D
Re: Off the wall UI issue
Quote:
Originally Posted by Hack
It sounds like that is what he is doing, but it doesn't seem to be acceptable to his users (for some odd reason)
It's not an odd reason, they are colorblind. They can't see the text in the textbox if it is disabled and they need to be able to see it yet it must be. The two shades of gray are not different enough for them to see.
Look, I'm sorry if the needs coming from this department seem over the top. I agree that they are, however that doesn't mean I can neglect them so I will try to fill them as best I can.
Do you realize that about 1 in 4 men are colorblind?
Re: Off the wall UI issue
Rob, doesn't matter how many containers, once you set any parent to disabled, the textbox will look disabled as well (since it is)
VBGuy,
Set the textbox's readonly property to true (this will make it look disabled), then set its backcolor property to white.
Now regardless of it being enabled/disabled, it will maintain its color.
Re: Off the wall UI issue
Quote:
Do you realize that about 1 in 4 men are colorblind?
:eek2:
kleinma: wont that still allow the box to be targetable??
D
Re: Off the wall UI issue
not if you set it disabled. In my post I said
Quote:
Now regardless of it being enabled/disabled, it will maintain its color.
"it" meaning backcolor of the textbox
Now the forecolor (text) will still look gray when the box is disabled, but the background will be white, not gray, so it SHOULD make the text reable to these customers.
Re: Off the wall UI issue
I have settled on grabbing mini screenshot of the enabled textbox, putting the image in a small picturebox overlay the image over the control when the control looses focus.
This meets their needs, I get the project done this afternoon, and even though if feels dirty I can always take a shower when I get home.
Re: [RESOLVED] Off the wall UI issue
ok...that seems a bit excessive. Did you see my post about just shifting focus to another control??
D
Re: Off the wall UI issue
Quote:
Originally Posted by kleinma
Rob, doesn't matter how many containers, once you set any parent to disabled, the textbox will look disabled as well (since it is)
VBGuy,
Set the textbox's readonly property to true (this will make it look disabled), then set its backcolor property to white.
Now regardless of it being enabled/disabled, it will maintain its color.
Bah! It was that way with VB 6, but no longer for .NET. sorry about that VBGuy
Re: Off the wall UI issue
Quote:
Originally Posted by VBGuy
I have settled on grabbing mini screenshot of the enabled textbox, putting the image in a small picturebox overlay the image over the control when the control looses focus.
This meets their needs, I get the project done this afternoon, and even though if feels dirty I can always take a shower when I get home.
You would be WAYYY better off toggling visiblity of the textbox and a label, having the label be the same size and location of the textbox, and have the label "act" like a disabled textbox (which it does rather well).
I even consider this method a bit dirty, but way cleaner than what you said above... :eek2: