Connecting Tech Pros Worldwide Help | Site Map
 
 
LinkBack Thread Tools Search this Thread
  #1  
Old February 18th, 2006, 11:15 AM
AA Arens
Guest
 
Posts: n/a
Default Setfocus jumps to next field, but default value is selected in that field.

I use SetFocus to jump from one field to another. That works fine. But
one of the focussed fields has default text and this text is selected
and the cursor is on the left of it. How to have the curosr positioned
at the right of the default (or filled) text?

Bart
(v 2003)




  #2  
Old February 18th, 2006, 11:25 AM
Jeff Smith
Guest
 
Posts: n/a
Default Re: Setfocus jumps to next field, but default value is selected in that field.


"AA Arens" <bartvandongen@gmail.com> wrote in message
news:1140260584.116216.310060@g44g2000cwa.googlegr oups.com...[color=blue]
>I use SetFocus to jump from one field to another. That works fine. But
> one of the focussed fields has default text and this text is selected
> and the cursor is on the left of it. How to have the curosr positioned
> at the right of the default (or filled) text?
>
> Bart
> (v 2003)
>[/color]

First things first, why are you using SetFocus jump from one field to
another? Why don't use set the tab order correctly?

Here's a solution for your question

After the line Me![FieldName].SetFocus
Me![FieldName].SelStart = Len(Me![FieldName])

Jeff


  #3  
Old February 18th, 2006, 01:35 PM
AA Arens
Guest
 
Posts: n/a
Default Re: Setfocus jumps to next field, but default value is selected in that field.

Hi Jeff,

It works. I use SetFocus as most of the field as list boxes and after
selecting the right value it jumps to the next value which it does not
with only TAB or when there is no List Box. I already set the right TAB
order.
Regarding that, when there is no list box, I use to use TAB. How to
have the cursor also jumped to the right?
I guess I need to choose the KeyPress part.

Bart

  #4  
Old February 18th, 2006, 02:55 PM
RoyVidar
Guest
 
Posts: n/a
Default Re: Setfocus jumps to next field, but default value is selected in that field.

AA Arens wrote in message
<1140268810.203914.3940@g43g2000cwa.googlegroups.c om> :[color=blue]
> Hi Jeff,
>
> It works. I use SetFocus as most of the field as list boxes and after
> selecting the right value it jumps to the next value which it does not
> with only TAB or when there is no List Box. I already set the right TAB
> order.
> Regarding that, when there is no list box, I use to use TAB. How to
> have the cursor also jumped to the right?
> I guess I need to choose the KeyPress part.
>
> Bart[/color]

The lazy way, could be to enter Tools | Options - in the Keyboard tab,
then akter the "Behavior entering field" property (Go to end of field).

This can be manipulated programatically too, if you like (some typed
not tested sample)

' declaration section
private lngProp as long

' in a sub...
lngProp = application.getoption("behavior entering field")
if lngProp <> 2 then
application.setoption "behavior entering field", 2
end if

' then afterwards (form close/unload?) reset

BTW - if you intend to try to trap through some of the key events, try
the KeyDown. I dont think the KeyPress will catch keys that will cause
the focus to change ...

--
Roy-Vidar


  #5  
Old February 21st, 2006, 01:55 PM
Arno R
Guest
 
Posts: n/a
Default Re: Setfocus jumps to next field, but default value is selected in that field.


"AA Arens" <bartvandongen@gmail.com> schreef in bericht news:1140260584.116216.310060@g44g2000cwa.googlegr oups.com...[color=blue]
>I use SetFocus to jump from one field to another. That works fine. But
> one of the focussed fields has default text and this text is selected
> and the cursor is on the left of it. How to have the curosr positioned
> at the right of the default (or filled) text?[/color]

You will need to look at Selstart in Help

Arno R
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,414 network members.