Results 1 to 24 of 24

Thread: [RESOLVED] Off the wall UI issue

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2002
    Location
    The Big D
    Posts
    310

    [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?
    Last edited by VBGuy; Dec 5th, 2007 at 02:48 PM.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Off the wall UI issue

    Set the Locked property of the textbox to True.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2002
    Location
    The Big D
    Posts
    310

    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.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2002
    Location
    The Big D
    Posts
    310

    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.

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    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?

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2002
    Location
    The Big D
    Posts
    310

    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.

  7. #7
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    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.

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2002
    Location
    The Big D
    Posts
    310

    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...

  9. #9
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    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?

  10. #10
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  11. #11

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2002
    Location
    The Big D
    Posts
    310

    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.

  12. #12
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    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)

  13. #13
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Off the wall UI issue

    No, another panel for each textbox that needs to preserve this look.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  14. #14

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2002
    Location
    The Big D
    Posts
    310

    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.

  15. #15
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  16. #16
    Fanatic Member
    Join Date
    Aug 2006
    Location
    In my head
    Posts
    913

    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
    Platforms of choice: Visual Studio 2005/2008 Professional : Visual Studio 2010 Enterprise : PHP - Notepad++/WAMP

    Please Rate If I helped you.
    Please remember to mark threads as closed if your issue has been resolved.

    Reserved Words in Access | Connection Strings

  17. #17

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2002
    Location
    The Big D
    Posts
    310

    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?

  18. #18
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    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.

  19. #19
    Fanatic Member
    Join Date
    Aug 2006
    Location
    In my head
    Posts
    913

    Re: Off the wall UI issue

    Do you realize that about 1 in 4 men are colorblind?


    kleinma: wont that still allow the box to be targetable??

    D
    Platforms of choice: Visual Studio 2005/2008 Professional : Visual Studio 2010 Enterprise : PHP - Notepad++/WAMP

    Please Rate If I helped you.
    Please remember to mark threads as closed if your issue has been resolved.

    Reserved Words in Access | Connection Strings

  20. #20
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: Off the wall UI issue

    not if you set it disabled. In my post I said

    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.

  21. #21

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2002
    Location
    The Big D
    Posts
    310

    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.

  22. #22
    Fanatic Member
    Join Date
    Aug 2006
    Location
    In my head
    Posts
    913

    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
    Platforms of choice: Visual Studio 2005/2008 Professional : Visual Studio 2010 Enterprise : PHP - Notepad++/WAMP

    Please Rate If I helped you.
    Please remember to mark threads as closed if your issue has been resolved.

    Reserved Words in Access | Connection Strings

  23. #23
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  24. #24
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    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...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width