Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Fun with Textboxes
Message
 
 
To
17/09/1998 23:27:20
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00138043
Message ID:
00138502
Views:
15
I realize you're showing a fox trick, but here's something that can go in the KeyPress which will give the correct effect:
*-- If this is a lower case letter
IF BETWEEN(nKeyCode,ASC("a"),ASC("z"))
    *-- If it is the first letter or a letter after a space
    IF this.SelStart=0 OR (this.SelStart>0 and SUBSTR(this.Value,this.SelStart,1)=" ")
        *-- Uppercase the letter
        NODEFAULT
        RETURN DoDefault(nKeyCode-32,nShiftAltCtrl)
    ENDIF
ENDIF

*-- If this is an upper case letter
IF BETWEEN(nKeyCode,ASC("A"),ASC("Z"))
    *-- If it is the not the first letter or a letter after a space
    IF !(this.SelStart=0 AND (this.SelStart>0 and SUBSTR(this.Value,this.SelStart,1)=" "))
        *-- Lowercase the letter
        NODEFAULT
        RETURN DoDefault(nKeyCode+32,nShiftAltCtrl)
    ENDIF
ENDIF
>I think because it's resetting the "SelStart" value.
>
>>Thanks for the Stupid FoxPro Trick, John. :)
>>
>>You also can have fun simply with
>>
>> THIS.Value=THIS.Value
>>
>>in InteractiveChange. Wonder why it does that??
Rick Hodder
MCP Visual Foxpro
C#, VB.NET Developer
Independent Consultant
www.RickHodder.com
MyBlog
Previous
Reply
Map
View

Click here to load this message in the networking platform