Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: David Hall
  Where is David Hall?
 United Kingdom
 David Hall
 To: tushar Kanvinde
  Where is tushar Kanvinde?
 Kolhapur, Maharastra
 tushar Kanvinde
Subject: RE: list box selection
Thread ID: 143496 Message ID: 143624 # Views: 1 # Ratings: 0
Version: Visual FoxPro 7 Category: Classes and Objects
Date: Thursday, August 30, 2007 12:07:38 PM         

> > I have a problem on a tight linking between a drop-down list box and a text box, which is probably very familiar to many people.
> >
> > The list box is various methods of payment, such as Mastercard, Maestro, (various forms of card), and cash, account, internet (various non-card ways of paying). These methods are defined in a short table, with 7 fields
> >
> > tp_paytype payment type description (Mastercard, Account etc)
> > tp_paycode payment type coded as 3 characters for accounts
> > tp_card logical, is a card payment or not
> > tp_issue logical, card type requires an issue number
> > tp_present logical, card type requires card user present
> > tp_digit the first digit applicable to the card type
> > tp_shape 'format' for the card type e.g. 4x4 digits etc.
> >
> > When the payment type is selected, the associated text box containing the card number is formatted according to tp_shape and displays a previously-supplied number or accepts a number in the required format and is enabled or not according to if it is a card or not.
> >
> > So far so normal, the formatting of the card text box happens in the drop-down list box valid event, and the focus is passed to the card text box in the list-box interactive change event. The text box validates that the card number starts with the correct digit in the valid event.
> >
> > The drop-down list box and text box are implemented as objects.
> >
> > My problem is this could all work better. For example, if the user re-selects the same payment type, the interactive change does not fire and the focus remains in the list-box. ALSO the first time the list-box is changed the interactive change event fails to fire. I dont understand this - at the first change, the interactive change fails to fire, but it then always fires as expected afterwards and the card number text box gets the focus as expected. Why not the first time?
> >
> > What I would like is that the card text box ALWAYS receives the focus immediately after the drop-down list-box is 'selected' EVEN IF the value does not change. How can I do this?
> David
> InteractiveChange is fired when a user makes a change in the value even if the control does not loose focus. In a textbox, it will fire for every character you type or delete.
> ProgrammaticChange is fired when some code changes the value. So if the lostfocus of another control changes the value of your control, the programmatic change will be fired.
> Valid event is fired when the user changes the value and then the control looses control.
> LostFocus is fired when the control looses control.
> I think you should also call the method from the ProgrammaticChange event.
> Regards
> Tushar

No good Tushar, none of the events you mention fire. The interactive change does not fire if the value does not change. Neither does the lost focus, though, because for whatever reason, a drop-down list box does not loose the focus under any circumstances except the user physically selecting another object with mouse or keyboard. The programmatic change does not fire if all the user is doing is keyboard or mouse to select another value in a drop-down list box.

My solution is to put the reformatting code in the Valid clause, and add a KEYBOARD '{TAB}' which forces the credit card box to get the focus whatever the user does to select a drop-down value, even when no change is made.


list box selection Posted by David Hall @ 8/29/2007 10:58:43 AM
RE: list box selection Posted by Ken Murphy @ 8/29/2007 1:15:14 PM
RE: list box selection Posted by David Hall @ 8/30/2007 12:03:57 PM
RE: list box selection Posted by tushar @ 8/29/2007 1:28:24 PM
RE: list box selection Posted by David Hall @ 8/30/2007 12:07:38 PM
RE: list box selection Posted by tushar @ 8/30/2007 2:04:16 PM
RE: list box selection Posted by David Hall @ 8/30/2007 10:05:50 PM
RE: list box selection Posted by tushar @ 8/30/2007 10:36:38 PM