|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Control FocusOther than setting the focus to another control when a control is clicked, is
there a way to not get the focus rectangle to show on a control? e.g. when an OptionButton is clicked it is depressed and a focus rectangle is displayed. I do not want the focus rectangle so I set the focus on another control, typically a picturebox that holds the OptionButtons. So, sometimes this forces me to include a pcturebox when I really have no need for it. VB6 "Bee" <B**@discussions.microsoft.com> wrote in message Try sending BM_SETSTATE to the button.news:7703D74E-5E41-4D86-AA4F-8EACBE650743@microsoft.com... > Other than setting the focus to another control when a control is clicked, > is > there a way to not get the focus rectangle to show on a control? > e.g. when an OptionButton is clicked it is depressed and a focus rectangle > is displayed. > I do not want the focus rectangle so I set the focus on another control, > typically a picturebox that holds the OptionButtons. > So, sometimes this forces me to include a pcturebox when I really have no > need for it. > VB6 "Bee" <B**@discussions.microsoft.com> wrote in message Personally I prefer the method of seting focus to another control, such as a news:7703D74E-5E41-4D86-AA4F-8EACBE650743@microsoft.com... > Other than setting the focus to another control when a control > is clicked, is there a way to not get the focus rectangle to show > on a control? PictureBox, but if you would prefer not to do that then one alternative is to send a KillFocus message: Option Explicit Private Declare Function SendMessage Lib "user32" _ Alias "SendMessageA" (ByVal hwnd As Long, _ ByVal wMsg As Long, ByVal wParam As Long, _ lParam As Any) As Long Private Const WM_KILLFOCUS = &H8 Private Sub Option1_Click() SendMessage Option1.hwnd, WM_KILLFOCUS, 0&, ByVal 0& End Sub You may also want to set Tabstop to False on the complete set of Option Buttons, or otherwise add code to get rid of the focus rectangle if the user Tabs to an Option Button. Mike "Bee" <B**@discussions.microsoft.com> wrote in message The focus rectangle serves an important purpose....to let the user know what news:7703D74E-5E41-4D86-AA4F-8EACBE650743@microsoft.com... > Other than setting the focus to another control when a control is clicked, > is > there a way to not get the focus rectangle to show on a control? > e.g. when an OptionButton is clicked it is depressed and a focus rectangle > is displayed. > I do not want the focus rectangle so I set the focus on another control, > typically a picturebox that holds the OptionButtons. > So, sometimes this forces me to include a pcturebox when I really have no > need for it. control currently has focus. This is especially important for users that are navigating by using the keyboard or some means other than the mouse. Therefore, it's usually not a good idea to "hide" the focus rectangle. If you're the only one using the app, then I guess that's your prerogative, But if this app is being used by others, this is not something that I, for one, would recommend you do. But to answer your question, no, I don't think there is. A search at www.google.com (which you could have done yourself), did not turn any up anything other than what you're already doing. I suppose there might very well be an API function or some other way (subclassing perhaps), but setting focus to another control was the only answer I managed to find (granted, I didn't not check ALL hits that were found, only the first few). -- Mike Focus Rect is Turned Off by default OS installation. unsless Turned On by
user. "Abhishek" <m*@server.com> wrote in message What in the hell are you talking about?news:OLTKOa31JHA.3676@TK2MSFTNGP06.phx.gbl... > Focus Rect is Turned Off by default OS installation. unsless Turned On by > user. desktop properties > Appearance > Effects > Hide underlined lettter for
keyboard navigation until i press the alt key If this checkbox is checked, Focus Rect wont draw. and its checked by default. Show quoteHide quote "Jeff Johnson" <i.get@enough.spam> wrote in message news:Ob0n3m$1JHA.5772@TK2MSFTNGP02.phx.gbl... | "Abhishek" <m*@server.com> wrote in message | news:OLTKOa31JHA.3676@TK2MSFTNGP06.phx.gbl... | | > Focus Rect is Turned Off by default OS installation. unsless Turned On by | > user. | | What in the hell are you talking about? | | "Abhishek" <m*@server.com> wrote in message I think you're talking about a different focus rectangle than the OP, who news:e7jdCEB2JHA.1712@TK2MSFTNGP03.phx.gbl... > desktop properties > Appearance > Effects > Hide underlined > lettter for keyboard navigation until i press the alt key. If this > checkbox is checked, Focus Rect wont draw. and its checked > by default. was actually asking about the "dotted line" focus rectangle that is drawn around the text portion of various controls on the Form when the user selects them using the mouse, such as the focus rectangle around the Caption text of a command Button or an Option Button. Mike "Abhishek" <m*@server.com>'s wild thoughts were released on Tue, 19 May 2009 05:03:11 +0530 bearing the following fruit:>desktop properties > Appearance > Effects > Hide underlined lettter for The 'underlined letter' won't but this has nothing to do>keyboard navigation until i press the alt key > >If this checkbox is checked, Focus Rect wont draw. and its checked by >default. with the fouces rect. J Show quoteHide quote > >"Jeff Johnson" <i.get@enough.spam> wrote in message >news:Ob0n3m$1JHA.5772@TK2MSFTNGP02.phx.gbl... >| "Abhishek" <m*@server.com> wrote in message >| news:OLTKOa31JHA.3676@TK2MSFTNGP06.phx.gbl... >| >| > Focus Rect is Turned Off by default OS installation. unsless Turned On >by >| > user. >| >| What in the hell are you talking about? >| >| > -- Jan Hyde "Jan Hyde" <StellaDrin***@REMOVE.ME.uboot.com> wrote in message Despite it's name, this property controls *both* the accelerator (underline) news:h44515hr58n9i5ash9r67etonmefrk9la1@4ax.com... > "Abhishek" <m*@server.com>'s wild thoughts were released on > Tue, 19 May 2009 05:03:11 +0530 bearing the following fruit: > >>desktop properties > Appearance > Effects > Hide underlined lettter for >>keyboard navigation until i press the alt key >> >>If this checkbox is checked, Focus Rect wont draw. and its checked by >>default. > > The 'underlined letter' won't but this has nothing to do > with the fouces rect. and focus rectangle. However it is broken in vb (forms). With the property enabled, a non-themed app will display both, while a themed app will display neither. And, pressing 'Alt' or other keyboard navigation keys will not change the state as it should. Msgboxes however, and other windows dialogs, do follow the property as expected. David "David Youngblood" <d**@flash.net>'s wild thoughts were released on Tue, 19 May 2009 22:10:25 -0500 bearing thefollowing fruit: Show quoteHide quote >"Jan Hyde" <StellaDrin***@REMOVE.ME.uboot.com> wrote in message It's not an option I would ever choose to have switched on,>news:h44515hr58n9i5ash9r67etonmefrk9la1@4ax.com... >> "Abhishek" <m*@server.com>'s wild thoughts were released on >> Tue, 19 May 2009 05:03:11 +0530 bearing the following fruit: >> >>>desktop properties > Appearance > Effects > Hide underlined lettter for >>>keyboard navigation until i press the alt key >>> >>>If this checkbox is checked, Focus Rect wont draw. and its checked by >>>default. >> >> The 'underlined letter' won't but this has nothing to do >> with the fouces rect. > >Despite it's name, this property controls *both* the accelerator (underline) >and focus rectangle. However it is broken in vb (forms). With the property >enabled, a non-themed app will display both, while a themed app will display >neither. And, pressing 'Alt' or other keyboard navigation keys will not >change the state as it should. Msgboxes however, and other windows dialogs, >do follow the property as expected. > >David > but if you're telling me that with it switched on I'd be unable to tell a button has focus then it sounds worse than I imagined. -- Jan Hyde
Show quote
Hide quote
"David Youngblood" <d**@flash.net> wrote in message That is absolutely, positively, 100% wrong. It would have taken you seconds news:uOtEgiP2JHA.4416@TK2MSFTNGP05.phx.gbl... >>>desktop properties > Appearance > Effects > Hide underlined lettter for >>>keyboard navigation until i press the alt key >>> >>>If this checkbox is checked, Focus Rect wont draw. and its checked by >>>default. >> >> The 'underlined letter' won't but this has nothing to do >> with the fouces rect. > > Despite it's name, this property controls *both* the accelerator > (underline) and focus rectangle. to test, as it did me. The check box does EXACTLY what it says and nothing more.
Show quote
Hide quote
"Jeff Johnson" <i.get@enough.spam> wrote in message I can only suggest that you spend a little more than a few seconds testing, news:%23Ek3GPV2JHA.3544@TK2MSFTNGP04.phx.gbl... > "David Youngblood" <d**@flash.net> wrote in message > news:uOtEgiP2JHA.4416@TK2MSFTNGP05.phx.gbl... > >>>>desktop properties > Appearance > Effects > Hide underlined lettter for >>>>keyboard navigation until i press the alt key >>>> >>>>If this checkbox is checked, Focus Rect wont draw. and its checked by >>>>default. >>> >>> The 'underlined letter' won't but this has nothing to do >>> with the fouces rect. >> >> Despite it's name, this property controls *both* the accelerator >> (underline) and focus rectangle. > > That is absolutely, positively, 100% wrong. It would have taken you > seconds to test, as it did me. The check box does EXACTLY what it says and > nothing more. I have. Try this in XP, Open the Display Properties Effects page Set focus to the 'Hide underlined letters...' checkbox (heading may differ among OS's) Press F1 and read the help text for this property (copy/pasted below) "Specifies whether to suppress the drawing of keyboard shortcuts (the underlined characters in menus and controls) and input focus indicators (the dotted rectangles around objects), until you actually start using the keyboard to navigate in Windows, generally with the ALT, TAB, or arrow keys." While you were there did you notice that if the property was enabled that there is *no* focus rectangle displayed until you press one of the keyboard navigation keys? Try it. I as said earlier, this *feature* does not function properly in VB and it's behavior is different between themed and non-themed VB applications. I have posted code in the past to override this property and I'll post it again here. Option Explicit Private Const WM_CHANGEUISTATE As Long = &H127 Private Const UISF_HIDEFOCUS As Integer = &H1 Private Const UISF_HIDEACCEL As Integer = &H2 Private Const UIS_CLEAR As Integer = &H2 Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" ( _ ByVal hwnd As Long, _ ByVal wMsg As Long, _ ByVal wParam As Long, _ lParam As Any) As Long Private Sub Form_Load() Dim uiState As Long uiState = MakeLong(UIS_CLEAR, UISF_HIDEFOCUS Or UISF_HIDEACCEL) SendMessage Me.hwnd, WM_CHANGEUISTATE, uiState, ByVal 0 End Sub Private Function MakeLong(ByVal wLow As Integer, ByVal wHigh As Integer) As Long MakeLong = wHigh * &H10000 + wLow End Function David "David Youngblood" <d**@flash.net> wrote in message Ahhhh, that's a much clearer explanation, thank you. I didn't understand news:O99xGlW2JHA.4412@TK2MSFTNGP06.phx.gbl... > "Specifies whether to suppress the drawing of keyboard shortcuts (the > underlined characters in menus and controls) and input focus indicators > (the dotted rectangles around objects), until you actually start using the > keyboard to navigate in Windows, generally with the ALT, TAB, or arrow > keys." what you meant at first when you said "navigation keys"; I thought you just meant menu navigation keys, i.e., Alt & F10. And now that I see it in action, I think it's utterly horrible. It's bad enough that they turned off the underlines to begin with, but ALL focus indicators? Yuck. On Wed, 20 May 2009 16:43:24 -0400, "Jeff Johnson" <i.get@enough.spam> wrote: Yuck indeed. It seems Microsoft has become so infatuated with the "kewl" factor>And now that I see it in action, I think it's utterly horrible. It's bad >enough that they turned off the underlines to begin with, but ALL focus >indicators? Yuck. in its user interfaces that it has abandoned any thoughts of ~actual~ usability. I blame it on Microsoft's apparently incurable Mac-envy. Others will, of course, disagree. RW Yes it's horrible but it can be fixed.
Call this in the form load: Public Sub EnableUIFocusMarks(FrmHWnd As Long) Call SendMessageAny(FrmHWnd, WM_CHANGEUISTATE, USIF_RESETUI, ByVal 0) End Sub Declarations: Private Const WM_CHANGEUISTATE As Long = &H127 Private Const USIF_RESETUI As Long = &H30002 Private Declare Function SendMessageAny Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long ' COMMENT 'USIF_RESETUI = ' (LoBytes) Const UIS_CLEAR As Integer = &H2 ' + (HiBytes) Const UISF_HIDEFOCUS As Integer = &H1 ' + (HiBytes) Const UISF_HIDEACCEL As Integer = &H2 Dave O. <RonW@no_domain.invalid> wrote in message Show quoteHide quote news:3p7b155umnjt4tado8gpnoh39bnri14sth@4ax.com... > On Wed, 20 May 2009 16:43:24 -0400, "Jeff Johnson" <i.get@enough.spam> > wrote: > >>And now that I see it in action, I think it's utterly horrible. It's bad >>enough that they turned off the underlines to begin with, but ALL focus >>indicators? Yuck. > > Yuck indeed. It seems Microsoft has become so infatuated with the "kewl" > factor > in its user interfaces that it has abandoned any thoughts of ~actual~ > usability. > I blame it on Microsoft's apparently incurable Mac-envy. Others will, of > course, > disagree. > > RW "Dave O." <nob***@nowhere.com> wrote in message As much as I hate it, I hate any program which screws with my user news:%23CdLIns2JHA.5772@TK2MSFTNGP02.phx.gbl... > Yes it's horrible but it can be fixed. > Call this in the form load: settings--without asking my permission first--more. "Abhishek" <m*@server.com> wrote in message This is not a focus rectangle, it is a "mnemonic."news:e7jdCEB2JHA.1712@TK2MSFTNGP03.phx.gbl... > desktop properties > Appearance > Effects > Hide underlined lettter for > keyboard navigation until i press the alt key > > If this checkbox is checked, Focus Rect wont draw. and its checked by > default. "Jeff Johnson" <i.get@enough.spam> wrote in message I know VB refers to it as a mnemonic but that's a really bad name for it; news:uHNPGeI2JHA.3812@TK2MSFTNGP05.phx.gbl... > "Abhishek" <m*@server.com> wrote in message > news:e7jdCEB2JHA.1712@TK2MSFTNGP03.phx.gbl... > >> desktop properties > Appearance > Effects > Hide underlined lettter for >> keyboard navigation until i press the alt key >> >> If this checkbox is checked, Focus Rect wont draw. and its checked by >> default. > > This is not a focus rectangle, it is a "mnemonic." they help you get to a specific control quickly via the keyboard but they don't really help you remember anything... Calling them "accelerator keys" at least makes some sense. Either way, they definitely have nothing to do with focus rectangles. Thanks for the helpful suggestions.
Show quoteHide quote "Bee" wrote: > Other than setting the focus to another control when a control is clicked, is > there a way to not get the focus rectangle to show on a control? > e.g. when an OptionButton is clicked it is depressed and a focus rectangle > is displayed. > I do not want the focus rectangle so I set the focus on another control, > typically a picturebox that holds the OptionButtons. > So, sometimes this forces me to include a pcturebox when I really have no > need for it. > VB6 >
can the loading of a large number of records go as quick as in DOS
Help using SendMessage() function Auto Spacing Labels in 2D Graph What is Sendkeys Chr(188)? 8 to 24 Download website OLEDragDrop custom format FMLabs FMTKit functions Is using raw, uncooked Winsock so bad? BigInteger and BigDecimal [equivalents] for VB.NET? |
|||||||||||||||||||||||