Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP3 Classes - NODEFAULT ???
Message
De
03/03/1998 04:09:05
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00082109
Message ID:
00082233
Vues:
31
>What is this nodefault thing describe in the help file?
>Does it basically tell the control to not do the default behaivour?
>i.e. if you try to tab out of a box and the data is invalid, to stay in the box you add nodefault.
>But where, how,....
>
>What I would like to do is this.
>I have a Cotainer that contains a label, a textbox and a combo box.
>If the data entry in the text box is invalid, I would like to activate the combo box, set focus to it.
>I would like to stay in the box to correct the error.
>
>What is happening now is this.
>
>User enters an incorrect value in the text box.
>Combo Box pops up. However the focus does not stay in the combo box, rather moves to the next field.
>
>Future enhancement:
>Also, I would like to move the pointer to the record in the combo box to the closest match before showing the combo box. (RowSource of combo box is an SQL statement.)
>
>Thanks a lot,
>
>Mike
Mike,
Nodefault is as you thought "do not execute default behaviour". ie:
*textbox.lostfocus
if lIncorrectData
   this.setfocus      && Set focus to self fails for default beh. of lostfocus
else
   ...
endif

if lIncorrectData
   nodefault          && Kill default beh.
   this.setfocus      && Set focus to self 
else
   ...
endif
* This is a nasty valid implementation - sometimes handy
When implemented to your case (including "future enhancement-softseek"):
*textbox.lostfocus
if lIncorrectData
  select cnt(*) from myTable ;
    order by myOrder ;
    where myKey < trim(this.value) ;
    into array aTemp       && myOrder and myKey match with rowsource
  This.parent.Combo1.listindex = ;
    min(iif(type("aTemp")="U",0,aTemp[1])+1,;
    This.parent.Combo1.listcount)
  This.parent.Combo1.setfocus  && Combo and text are in same (parent) container
else
   ...
endif
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform