Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
One field in 2 Grid Columns
Message
De
30/10/1999 12:59:48
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
30/10/1999 08:33:14
Vinod Parwani
United Creations L.L.C.
Ad-Dulayl, Jordanie
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00282876
Message ID:
00284336
Vues:
12
>>>I want to make a data-entry grid to simulate 2 columns for 1 field.
>>>
>>>I've a Amount field and want to display 2 columns in grid i.e. Dr Amount, Cr Amount
>>>
>>>User should be able to enter numeric value in any of the columns, and after entering data in one row, Valid routine will update the DBCR field (Logical) to indicate whether its Debit amt or credit amt..
>>>
>>>Anybody having any ideas to do it..
>>>
>>>TIA..
>>
>>
Use a container as control in that grid column. Then you could even a form or another grid in one column :)
>>Cetin
>
>Pls note that now I'm using 2 text boxes in container, Each textbox's refresh is having following code :-
>
>This.Value = ThisForm.RetJvAmt(This.Name)
>
>But it is not refreshing values..
>
>Pls advs..


Vinod,
This is a quick implementation. You could enhance it to your taste. Create two container classes as below and drop both of them on to column. Set DynamicCurrentControl :
*container credit
* Custom properties
* cFlag           - Holds table.fieldname of flag
* Controlsource   - Holds table.fieldname of creditdebit
* Custom method   :
* movefocus()     - Moves focus off column

*container credit.init
With this
  .ChkFlag.ControlSource = .cFlag
  .txtCredit.Controlsource = .ControlSource
  .txtDebit.Value = 0
Endwith

*container credit.movefocus
With this.parent
  lnThisPos = .columnorder
  With .Parent
    lnNextOrder = iif(lnThisPos = .ColumnCount, 1, lnThisPos + 1)
    lnPrevOrder = iif(lnThisPos = 1, .ColumnCount, lnThisPos - 1)
    For ix = 1 to .ColumnCount
      If .Columns(ix).ColumnOrder = ;
          iif(inlist(lastkey(), 15, 19), lnPrevOrder, lnNextOrder)
        .Columns(ix).SetFocus()
        Exit
      Endif
    Endfor
  Endwith
Endwith

* txtDebit.Lostfocus
With this.parent
  If this.Value # 0
    .txtCredit.Value = this.Value
    .ChkFlag.Value = .F.
    This.Value = 0
    .MoveFocus()
  Endif
Endwith
* txtCredit.Lostfocus
With this.parent
  If this.Value # 0
    .ChkFlag.Value = .T.
    .txtDebit.Value = 0
    .MoveFocus()
  Endif
Endwith


* container debit.init && Subclassed from container credit
With this
  .ChkFlag.ControlSource = .cFlag
  .txtDebit.Controlsource = .ControlSource
  .txtCredit.Value = 0
Endwith
*txtCredit.Lostfocus
With this.parent
  If this.Value # 0
    .txtDebit.Value = this.Value
    .ChkFlag.Value = .T.
    This.Value = 0
    .MoveFocus()
  Endif
Endwith
*txtDebit.Lostfocus
With this.parent
  If this.Value # 0
    .ChkFlag.Value = .F.
    .txtCredit.Value = 0
    .MoveFocus()
  Endif
Endwith

* Grid.Column.Dynamiccurrentcontrol :
* iif(mytable.myflag, "ContainerCredit", "ContainerDebit")
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform