Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
FYI; Problem with PADL; .NULL. in SELECT SQL
Message
De
24/06/2009 08:35:23
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
 
À
24/06/2009 08:27:09
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01407500
Message ID:
01407995
Vues:
21
>This seems to work:
>
>Public oForm
>oForm = Createobject('comboSample')
>oForm.Show
>
>Define Class comboSample As Form
>  Top = 0
>  Left = 0
>  Height = 350
>  Width = 620
>  DataSession=2
>
>  Add Object grdItems As Grid With ;
>    Height = 300, ;
>    Left = 10, ;
>    Top = 10, ;
>    Width = 600, ;
>    Rowheight = 19,;
>    RecordSource = "crsItems"
>
>  Procedure Load
>    Set Fixed On
>    Set Point To ","
>
>    Select Cast(.Null. As Int) As ProductID, Cast('' As c(50)) As prod_name ;
>      FROM (_samples+'Data\products') ;
>      UNION ;
>      select Int(Val(product_id)) As ProductID,prod_name ;
>      FROM (_samples+'Data\products') ;
>      INTO Cursor crsProducts ;
>      readwrite
>    Index On ProductID Tag ProductID
>
>    Create Cursor crsItems ;
>      (LINE_NO i, ORDER_ID c(6), ;
>      ProductID i Null, UNIT_PRICE Y, QUANTITY i)
>
>    Insert Into crsItems ;
>      Select LINE_NO, ORDER_ID, ;
>      Val(product_id) As ProductID, ;
>      UNIT_PRICE, QUANTITY ;
>      From (_samples+'data\orditems')
>    Locate
>
>    Use In 'products'
>    Use In 'orditems'
>
>  Endproc
>
>  Procedure grdItems.Init
>    Local ix
>    With This
>      For ix = 1 To .ColumnCount
>        If Upper(Justext(.Columns(m.ix).ControlSource)) == 'PRODUCTID'
>          With .Columns(m.ix)
>            .Bound = .F.
>            .ControlSource = "(Iif(Seek(crsItems.productid,"+;
>              "'crsProducts','productID'),crsProducts.prod_name,''))"
>            .Width = 180
>            .Alignment = 0
>            .AddObject('comboincol','mycombo')
>            With .ComboIncol
>              .BoundColumn = 2
>              .BoundTo = .T.
>              .ColumnCount = 2
>              .ColumnWidths = "180,100"
>              .RowSourceType = 3
>              .RowSource = "select prod_name,productID"+;
>                " from crsProducts"+;
>                " order by 1" +;
>                " into cursor crsComboSource"
>              .SpecialEffect = 1
>              .Style = 2
>              .ControlSource = "crsItems.productID"
>              .Visible = .T.
>            Endwith
>            .CurrentControl = 'comboincol'
>          Endwith
>          Exit
>        Endif
>      Endfor
>      .AddColumn(.ColumnCount+1)
>      .Columns(.ColumnCount).Name = 'showProdID'
>      .ShowProdID.ControlSource = '(crsItems.ProductID)'
>    Endwith
>  Endproc
>
>Enddefine
>
>Define Class myCombo As ComboBox
>  setFixed = ''
>  Procedure init
>    This.setFixed = Set('fixed')
>  endproc
>  Procedure when
>    Set Fixed Off
>  Endproc
>
>  Procedure LostFocus
>    Local cfixed
>    cfixed = This.setFixed
>    Set Fixed &cfixed
>  Endproc
>Enddefine
Cetin
Cetin

I will give it a try.
But plaing around with POINT and FIXED will be slow,(The grid might hold several colums with numbers on several thousend lines. If I alter FIXED each of them will be redrawn. Not to mention all the textboxes in the input container, filter etc.).
I do a lot of stuff with semiautomats that use macros. I've to fill them with numbers what allways raise the problem of POINT and FIXED, so I know to restrict its use.

Agnes
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform