Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SelectOnEntry in Textbox
Message
 
À
03/12/2003 08:55:29
Mike Sue-Ping
Cambridge, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00855187
Message ID:
00855394
Vues:
15
I don't see it happening in my code. My test selected the whole value that was longer than textbox width.

However, another way to achieve this in the same CASE statement would be:
CASE THIS.SELLENGTH = 0
KEYBOARD '{CTRL+A}' PLAIN
* THIS.SELSTART = 0
* THIS.SELLENGTH = 1000


>Hi Nick,
>
>While your suggestions adds some great functionality to the issue, one problem still remains that I have found. Instead of describing it again, Christian's original comment follows:
>
>>...except when the value is longer than the textbox shows, which results in shifting the entire selected text to the left. That is confusing for the user.
>>
>
>This still occurs in your code. Do you know of anyway to prevent it? Thanks again for your input.
>
>Regards,
>
>Mike
>
>
>>I wrote about this exact problem in Re: How to select textbox when mousing in Thread #846750 Message #846833
>>I will just repeat it here:
>>
>>< SNIP > *******************************************************************
>>The extended features of the Left Mouse click :)
>>
>>1. One short click selects the whole textbox value
>>2. You still can do the manual text selection in the box
>>3. If you click and hold the mouse for more than one second, the cursor will stay where you clicked and you still can do the normal editing.
>>4. As a bonus :) DoubleClick selects the existing text and the trailing spaces (but not the leading spaces (if any).
>>
>>
>>*** MouseDown() event
>>LPARAMETERS nButton, nShift, nXCoord, nYCoord
>>this.WhatsThisHelpID = INT(SECONDS())
>>
>>***MouseUp() event
>>LPARAMETERS nButton, nShift, nXCoord, nYCoord
>>IF nButton = 1
>>	DO CASE
>>		CASE ABS(INT(SECONDS()) - THIS.WHATSTHISHELPID ) > 1 && 1 sec delay
>>			* do nothing - leave the mouse pointer where it landed,
>> allowing to position within the textbox
>>		CASE THIS.SELLENGTH = 0
>>			THIS.SELSTART = 0
>>			THIS.SELLENGTH = 1000
>>		CASE THIS.SELLENGTH > 0
>>			* Leave the selection made as is
>>	ENDCASE
>>ENDIF
>>
>>I employed the rarely used WhatsThisHelpID property to hold the SECONDS() value
>>just for this example. Of course, you can use a custom property for that.
>>
>>I used THIS.SELLENGTH = 1000 for the whole text selection to avoid
>>unnecessary function calls.
>>
>>Using THIS.SELSTART = 0 and THIS.SELLENGTH = LEN(ALLTRIM(this.Value)) or THIS.SELLENGTH = LEN(ALLTRIM(this.Text)) is not reliable
>>if the textbox value has the leading spaces.
>>
>>< END SNIP > ****************************************************************
>>
>>P.S. Of course, you can just throw away the extra features if you don't need them.
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform