Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SelectOnEntry 1

Status
Not open for further replies.

PaulBarbeau

Programmer
Nov 23, 2000
109
0
0
CA
I am having a problem with this control. When i tab into the field it works however when i mouse click in it does not. I need to to select the whole field when i single click into it. Can anyone help me on this?

Paul
 
thanks by doing below it does work however not sure while selectonentry does not do the same thing.

this.SelStart = 0
this.sellength = 999
 
SelectOnEntry - Specifies whether text in a column cell, edit box, or text box selected when the user moves to it. Available at design time and run time.

SelText - Returns the text that the user selected in a text-entry area of a control, or returns an empty string ("") if no characters are selected. Specifies the string containing the selected text.Select a specific group of characters (substrings) in a control.

I think they are 2 different.
 
"user moves to it." is not clicking on the field moving into the field?
 
I dont`t understand what you meen with your post

User can move to any object with keyboard or mouse
When you move to object by keyboard (ex. TAB) - executes "GotFocus"
Moving with mouse (ex. Click) - executes "Click" or "DblClick"
 
Paul,
Change your textbox base class so that the GotFocus() method has:
Code:
DoDefault()
This.SetFocus()
Then if the use clicks anywhere in the field, the cursor will return "home" and if SelectOnEntry is .T., then the whole field will be selected.

Rick
 
rgbean,

That's a simple and very workable solution. Star.

Slighthaze = NULL
[sub]craig1442@mchsi.com[/sub][sup]
"Whom computers would destroy, they must first drive mad." - Anon​
[/sup]
 
Ramani,

All you need in the GotFocus() is the DODEFAULT(). Putting a This.SetFocus() can be dangerous if the textbox received focus through a calling chain that includes a Valid method anywhere up the chain.



-BP
 
Hi Barbara

Ramani,

All you need in the GotFocus() is the DODEFAULT(). Putting a This.SetFocus() can be dangerous if the textbox received focus through a calling chain that includes a Valid method anywhere up the chain.


Yes I do not recommend putting a SetFocus to the same control on its GotFocus event. Also, in general, I would not recommend tingering the TextBox default base class. Any changes should be in a subclassed TextBox class. I am sure Rick would have only meant that.

-----------------------------------------
The way to go for a textbox can be..

1. Text1.GotFocus
DODEFAULT()

2. Text1.Format = K
-----------------------------------------

:)

____________________________________________
ramani - (Subramanian.G) :)
When you ask VFP questions, please add VFP version.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top