Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Ken Murphy
  Where is Ken Murphy?
 Springhill
 Canada
 Ken Murphy
 To: David Hall
  Where is David Hall?
 Birmingham
 United Kingdom
 David Hall
 Tags
Subject: RE: list box selection
Thread ID: 143496 Message ID: 143512 # Views: 2 # Ratings: 0
Version: Visual FoxPro 7 Category: Classes and Objects
Date: Wednesday, August 29, 2007 1:15:14 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,

I take it that you have a custom method that contains the code to change the formatting of the card textbox, etc. and you call this method from the combo's .InteractiveChange() event. I would recommend that you move your method call to the .LostFocus() event. This event always fires when focus moves from the combo whereas the .InteractiveChange() event may not fire (there may be no changes to the value of the combo.) Also, you may want to explicitly tell your app to move the focus from the combo to a specific textbox (or what ever.) Take a look at the .SetFocus() method in help. ThisForm.MyTextbox.SetFocus()

Ken
You shall know the truth - and the truth shall set you free. (John 8:33)

ENTIRE THREAD

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