Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Editing fields without using the mouse
Message
From
13/03/2003 17:19:48
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00765549
Message ID:
00765612
Views:
21
You're welcome.

I agree with you...I suppose it could be a bug, and noone has noticed. Do they give out prizes for bug discovery? *grin*

The work around is simple, and if you are using custom classes (as apposed to the standard VFP base classes), you only have to put this code in one place, one time.

You don't need the code for the left arrow, as it does not do anything. *All* keystrokes are passing through this method, and the right arrow is the only one you are wanting to change.

BTW, if you are going to create your own textbox class, you may want to have something like this in it, too, to prevent the user from left-arrowing out of the box (you can tweak it to cover the case where there is some text selected):
if nKeyCode = 19 and nshiftaltctrl = 0 and this.selStart = 0
    nodefault
endif
>Thank you very much for your code.
>This works perfekt for the right arrow, but to have it work for the left arrow I made this modification:
>***
>do case
>case nKeyCode = 4 and nshiftaltctrl = 0
>     with this
>        if .selLength > 0
>            .selStart = .selStart + .selLength
>            nodefault
>        endif
>    endwith
>case nKeyCode = 19 and nshiftaltctrl = 0
>     with this
>        if .selLength > 0
>            .selStart = .selStart
>            nodefault
>        endif
>    endwith
>endcase
>***
>But schould not this behaviour be a ground standard in VFP as in other programs?
>It must be wrong to make my own code to do this???
>/Kjell
>
>
>
>>Kjell,
>>
>>Putting this in your keypress() method will cause it to behave like the editbox (you can put it in your baseclass):
>>
>>
>>LPARAMETERS nKeyCode, nShiftAltCtrl
>>
>>if nKeyCode = 4 and nshiftaltctrl = 0
>>    with this
>>        if .selLength > 0
>>            .selStart = .selStart + .selLength
>>            nodefault
>>        endif
>>    endwith
>>endif
>>
Steve Gibson
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform