Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting text from a specific line
Message
De
05/02/2016 14:29:31
 
 
À
05/02/2016 09:29:04
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01630920
Message ID:
01630947
Vues:
50
Hi tore
No Alines is the better solution because its independant of set memowidth(takes the values between 8-8192).
run this code ans see the diffrence entre the 2 methods .Each result is in the cursor ycurs
the 2tht button whose can solve the problem is for 'set memowidth to 8192' the max tolered.if you put 50 or another value you dont get the same result returned for each line.
see particulary the long line 1 how its divided (into 7 lines) . this is independently of form/editbox resizing
Publi oform
oform=Newobject("asup")
oform.Show
Read Events
Retu

Define Class asup As Form
    Top = 0
    Left = 0
    Height = 366
    Width = 670
    Caption = "Form1"
    Name = "Form1"

    Add Object edit1 As EditBox With ;
        Anchor = 15, ;
        Height = 253, ;
        Left = 48, ;
        Top = 36, ;
        Width = 505, ;
        Name = "Edit1"

    Add Object command1 As CommandButton With ;
        Top = 324, ;
        Left = 179, ;
        Height = 37, ;
        Width = 120, ;
        Anchor = 768, ;
        Caption = "Memowidth=8192", ;
        Name = "Command1"

    Add Object command2 As CommandButton With ;
        Top = 323, ;
        Left = 324, ;
        Height = 37, ;
        Width = 120, ;
        Anchor = 768, ;
        Caption = "Alines", ;
        Name = "Command2"

    Add Object command3 As CommandButton With ;
        Top = 326, ;
        Left = 39, ;
        Height = 37, ;
        Width = 120, ;
        Anchor = 768, ;
        Caption = "Memowidth=50", ;
        Name = "Command3"

    Procedure Load
        Set Safe Off
        Create Cursor ycurs (yline m)
    Endproc

    Procedure Destroy
        Clea Events
    Endproc

    Procedure edit1.Init
        TEXT to this.value noshow
		1.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin vel risus eget lorem feugiat.azzezezezezezezezezezezezezezezzezezezezzezezezezezezezezzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz END
		2.fermentum nec a turpis. Phasellus purus sem, mollis ac posuere eget, ornare vel orci. Sed ac rutrum
		3.nulla. Aenean ultrices eget lectus eu efficitur. In hac habitasse platea dictumst. Nulla in iaculis nisi.
		4.Nullam et pulvinar tellus. Donec arcu dui, efficitur a odio non, porta congue dolor. Aenean viverra
		5.auctor sagittis. Integer lobortis dignissim auctor. Proin et volutpat massa.
		6.Cras vitae felis venenatis, egestas sem quis, sodales neque. Donec venenatis hendrerit odio, non
		7.pellentesque metus scelerisque ac. Suspendisse aliquet rhoncus odio id viverra. Vestibulum feugiat
		8.lectus a nisl pulvinar, in tempor metus eleifend. Nunc id odio quam. Praesent egestas lorem ut
		9.sollicitudin consectetur. Vestibulum id bibendum est. Ut vel lacus sapien. Quisque eget molestie
		10.sem. Integer eget purus eu orci molestie aliquam quis in ante. Integer a magna eget lectus finibus
		11.porttitor. Donec fringilla sapien a quam aliquet, pellentesque blandit nisl placerat. Nam hendrerit
		12.velit vel ex aliquam, eget convallis ante mollis.
        ENDTEXT
    Endproc

    Procedure command1.Click

        Set Memowidth To 8192
        *Specifies a width between 8 and 8192 columns. The default width for output is 50 columns.max=8192.
        *if specify memowidth<8192 cannot obtain same line wanted.its variable
        *if memowidth set to 8192 obtain good result if len(string)<8192.

        Zap In Select("ycurs")
        With Thisform.edit1
            For i=1 To Memlines(.Value)
                Insert Into ycurs Values ( Mline(.Value,i))
            Endfor
        Endwith
        Locate
        Brow
    Endproc

    Procedure command2.Click
        *Alines is not affected by the value of set memoWidth.its more faster
        *its the best solution to retrieve a complet line from editbox without altering it.

        Zap In Select("ycurs")
        N=Alines (myArray,Thisform.edit1.Value)

        Sele ycurs
        For i=1 To N
            Insert Into ycurs  Values (myArray(i))
        Endfor
        Locate
        Brow
    Endproc


    Procedure command3.Click

        Set Memowidth To 50
        *Specifies a width between 8 and 8192 columns. The default width for output is 50 columns.max=8192.
        *if specify memowidth<8192 cannot obtain same line wanted.its variable
        *if memowidth set to 8192 obtain good result if len(string)<8192.
        *in this case result is totally wrong as escompted.

        Zap In Select("ycurs")
        With Thisform.edit1
            For i=1 To Memlines(.Value)
                Insert Into ycurs Values ( Mline(.Value,i))
            Endfor
        Endwith
        Locate
        Brow
    Endproc

Enddefine
*
*-- EndDefine: asup
***********************
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform