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!

TextBox Skipping on Delete?

Status
Not open for further replies.

ictoo

Programmer
Sep 3, 2009
33
GB
Hello everyone,

I wouldn’t say i have a problem, but it has bugged me since i started programming with FoxPro the way when you are deleting text out of a text box and you come to the end you will jump to the next text box in the tab order and this can be bad with users and they will continue to delete the next textbox in the order when not paying attention.

I’m using FoxPro 7 now sure if this is fixed now but i read about and this is a bug? As this is not the normal behavior with other programs. Has anyone found a way or worked out some code?

I would be interested in if this is a bug like i think, and how you lot have gotten around it.

I found this code while looking around the internet for more information.

*!* If Lastkey() = 127 And Empty(This.Value)
*!* Return 0
*!* EndIf

But that means when you delete the full text box you can’t move off... I’m not sure if you can then put an else in there for mouse click? I’m not sure what key that is.
 
I think I would be tempted to set confirm on:

from Help... said:
SET CONFIRM ON | OFF



Parameters
ON
Specifies that the user cannot exit a text box by typing past the last character in the text box. To exit the text box, the user can press ENTER, TAB, or any of the arrow keys to move from a text box to another control.

SET CONFIRM ON also affects menu items and menu titles created with DEFINE BAR and DEFINE PAD. If the user types the first letter of the menu item or menu title, the item or title is selected but is not chosen. To choose the menu item or title when it is selected, the user should press ENTER or the SPACEBAR.

OFF
Specifies that the user can exit a text box by typing past the last character in the text box. The insertion point, when it reaches the last character in a text box, moves to the next control, and the bell is sounded (if SET BELL is set to ON).

OFF is the default value of SET CONFIRM.

SET CONFIRM OFF also affects menu items and menu titles. If SET CONFIRM is set to OFF, the user can choose an item from a menu or a menu title in a menu bar by pressing the key corresponding to the first letter of the menu item or title. (When SET CONFIRM is set to ON, this action only selects the menu item or title.)

Remarks
SET CONFIRM has no effect on access keys for menu items and menu titles. If a menu item or menu title is created with an access key, the menu item or title can be chosen by pressing the corresponding access key.

You can create text boxes using the Form Designer.

SET CONFIRM is scoped to the current data session.

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
Ictoo,

GriffMG is right to point you to SET CONFIRM.

When the user finishes entering data into a control, the default behaviour is for the insertion point to jump to the next control in tab order. If you SET CONFIRM ON, the user has to hit the Tab or Enter key to move to the next control.

However, I'm not sure how that fits in with the fact that you are deleting data, not entering it. When you use the Delete key, the insertion point doesn't normally move, so it shouldn't be a problem.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
I *think* he means the backspace key Mike, it irritates my users too... although I'm mean and make them learn!

B0)

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
Yes.. the backspace im sorry i meant when using the backspace and you get to the end it jumps to another textbox in the tab order, and it irritates my users and then they irritate me, ive told them i cant find a way of stopping it so i thought i'd put it out there so see what you lot had done in this situation and it seems i'll just have to go along the lines of what Griff has done.
 
Ok, SET COMFIRM ON solved another problem when the user would go over the maxs char of the text box but still when using backspace to delete it jumps to the next textbox in the tab order, looks like I’ll just have to educate my users like griff has.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top