|
-
Catfish
VB Command Button focus
Can you set a command button to not accept any sort of focus? I know that the TabStop property says whether it can accept the focus from the TAB key, but can you have it be clickable but not accept focus?
I should write an ethnography about internet discussion boards.
-
Super Bunny Mod
well if you set Default to false, TabStop to false and don't put a & in the name to create a short-cut I don't see how it could get focus unless you added code to give it focus
If your sig is longer than your post then type more.
-
Catfish
If the user clicks the button, the focus is given to the button that was clicked. Any way to prevent this?
I should write an ethnography about internet discussion boards.
-
Catfish
I do not believe you can stop focus from occurring on a command button when the control is clicked. If your issue is that you want to return focus to where it was before the button is clicked perhaps use the gotfocus or lostfocus events on all other controls to log what last had focus and return focus to them at the end of the click event of the button.
P4 3.0E w/800 fsb, ASUS P4P800, 1024 MB Corsair XMS pc3200 DDR, ATI Radeon 9800 Pro, Seagate 120GB SATA, Sony 48/24/48 CDRW, 16X DVD, Antec Sonata case w/380W, Win2K Pro SP4, DX9.0b, Sony SDM-X72 17" LCD
-
.
What are you trying to do? Might be a better solution to your situation than focusing on just the command button.
---------------------------------------------------------------
- Asus M50 Laptop - C2D T9300 - 4 gig RAM - Radeon HD 3650 - Vista x64 Ultimate
- Intel i7-3770K - Asus P8Z77-V DELUXE - 32gig RAM - Radeon HD7970 Ghz - Plextor M3 256GB/120GB OCZ Vertex3
- LG BluRay - Razor Blackwidow Ultimate Keyboard - Logitech G9x
- HP ZR2740w/Asus LCD - W7 Ultimate
---------------------------------------------------------------
-
Catfish
on the button you dont want focus to get to,
set its focus to something else.
Code:
Private Sub Command1_GotFocus()
' code to do stuff here
' move focus to another button.
Command2.SetFocus
End Sub
or you could set the button to disabled
-
Catfish
The idea of setting the focus to another control is a good one. As for my situation, I'm sort of asking generally, but one example is I'm trying to make a very small button that would not need the focus, (like a "windowshade mode" button) and if it has the focus, the focus rectangle makes it look silly and clouds the icon I have on the button.
I should write an ethnography about internet discussion boards.
-
Catfish
The problem with disabling the button, or setting the focus to another control in the onfocus event is that then the button can not be clicked, so why have a button?
Onfocus fires before click. That is why I suggesteda as I did in my previous post.
why not use a picture box to load the icon instaed of a button and put your code in the onclick of this?
P4 3.0E w/800 fsb, ASUS P4P800, 1024 MB Corsair XMS pc3200 DDR, ATI Radeon 9800 Pro, Seagate 120GB SATA, Sony 48/24/48 CDRW, 16X DVD, Antec Sonata case w/380W, Win2K Pro SP4, DX9.0b, Sony SDM-X72 17" LCD
-
Catfish
Originally posted by ReWarrior
...why not use a picture box to load the icon instaed of a button and put your code in the onclick of this?
Not a bad idea. Can Picture Boxes receive focus?
Last edited by Geist; 01-12-2003 at 03:19 PM.
I should write an ethnography about internet discussion boards.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|