From: Claire on
How to not display focus at startup when the form contains the array of
check boxes covering the whole form?
Claire


From: Larry Serflaten on

"Claire" <replyto(a)fra> wrote
> How to not display focus at startup when the form contains the array of
> check boxes covering the whole form?

Focus HAS to go somewhere and it has to go to a control that is visible.
If you don't want the user to see a focus rectangle, you can add a 1x1 pixel
Picturebox with no borders (so it matches the form background) and set its
TabStop to 0 in the IDE. A Picturebox does not show a focus rectangle.

That will hide the focus on startup, but when the user goes tabbing through
the checkboxes, there will be a time when the focus seems to disappear
(when it gets back to the Picturebox). To avoid that, you can hide the
Picturebox (set Visible to False) in the GotFocus event of your Check
boxes. That way, when the user selects a checkbox, or starts tabbing
through the check boxes, the Picture box is hidden which takes it out
of the tab sequence.

HTH
LFS


From: Helmut Meukel on
How about an enabled, visible but hidden control? (a PictureBox, Textbox,
any control that can receive the focus will do).
Set its TabIndex to 0. and Left to -20000.
If you set Visible to false the Checkbox with the lowest TabIndex
will get the focus, but Visible = True and with Left = -20000 out of sight
it will get the focus.

Helmut.


"Claire" <replyto(a)fra> schrieb im Newsbeitrag
news:eLGSFxPqKHA.1796(a)TK2MSFTNGP02.phx.gbl...
> How to not display focus at startup when the form contains the array of
> check boxes covering the whole form?
> Claire
>

From: Claire on
I tried that before and it does not work for me.
Claire

"Helmut Meukel" <NoSpam(a)NoProvider.de> wrote in message
news:eiaS2kQqKHA.4492(a)TK2MSFTNGP05.phx.gbl...
> How about an enabled, visible but hidden control? (a PictureBox, Textbox,
> any control that can receive the focus will do).
> Set its TabIndex to 0. and Left to -20000.
> If you set Visible to false the Checkbox with the lowest TabIndex
> will get the focus, but Visible = True and with Left = -20000 out of sight
> it will get the focus.
>
> Helmut.
>
>
> "Claire" <replyto(a)fra> schrieb im Newsbeitrag
> news:eLGSFxPqKHA.1796(a)TK2MSFTNGP02.phx.gbl...
>> How to not display focus at startup when the form contains the array of
>> check boxes covering the whole form?
>> Claire
>>
>


From: MM on
On Mon, 8 Feb 2010 22:53:46 +0100, "Helmut Meukel"
<NoSpam(a)NoProvider.de> wrote:

>How about an enabled, visible but hidden control? (a PictureBox, Textbox,
>any control that can receive the focus will do).
>Set its TabIndex to 0. and Left to -20000.
>If you set Visible to false the Checkbox with the lowest TabIndex
>will get the focus, but Visible = True and with Left = -20000 out of sight
>it will get the focus.
>
>Helmut.
>
>
>"Claire" <replyto(a)fra> schrieb im Newsbeitrag
>news:eLGSFxPqKHA.1796(a)TK2MSFTNGP02.phx.gbl...
>> How to not display focus at startup when the form contains the array of
>> check boxes covering the whole form?
>> Claire
>>

I just tried a slight modification of this: Place 5x Check1 in a
control array on the form, plus 1x Text1 with its Left property set to
-200 and with a TabIndex of 0. Result: None of the checkboxes gets
focus.

In the Text1.GotFocus event I set its TabStop = False, so that tabbing
now only goes to the checkboxes with no gaps. No focus is shown until
the tab key is pressed for the first time.

MM