Always the right justify problem, with Formlib the textbox is so curious.

Discussion in 'Questions (Windows Mobile)' started by dan kabestan, Jan 17, 2008.

  1. dan kabestan

    dan kabestan Member Licensed User

    With Formlib, in a right textalignment the mono-line textbox content is right-HIDDEN after return keypress .
    That's amazing!
    Any way, just copying a mono-line Textbox1 input keyboard in a multi-line Textbox2,
    after some returns-keypress on Textbox1, it appears a go-down list in Textbox2 (as i would !)
    BUT, if i modify(use!) one character or more of Textbox1, the Textbox2 down-list no more work.
    In this case something as linefeed or carriage return is deleted , if i add it, it's a dirty result !
    Would you see the following :
    '----------------------------------------------------------------------------
    ' With Formlib dyn_form, textbox1 singleline, texbox2 multiline
    Sub App_Start
    Form1.Show
    dyn_form.New1("Form1",B4PObject(1))
    dyn_form.TextAlignment("TextBox1",dyn_form.alRight)
    dyn_form.TextAlignment("TextBox2",dyn_form.alRight)
    textbox1.Text ="" : textbox2.Text =""
    End Sub
    Sub TextBox1_KeyPress (key)
    If key = Chr(13) Then
    '-------------- test1 textbox1 modify -> the T2 list is OK
    'textbox1.Text = StrReplace(textbox1.Text,"5","x")
    '------------- test2 textbox1 modify -> linefeed is _lost_ in T2
    'textbox1.Text = (textbox1.Text *2)
    '---------------------------------------------------------------------
    textbox2.Text = textbox2.Text & textbox1.Text
    textbox2.Focus : textbox2.ScrollToCaret
    textbox1.Focus : textbox1.Text=""
    End If
    End Sub
    '-----------------------------------------------------------------------
    I tried many adds of chr(13) and chr(10) but the problem is little boxe at the return character place.
    (my actual solution : textbox2.Text = textbox2.Text & Chr(10) & textbox1.Text & Chr(13))
    Nota a little bug, it's impossible to clear the text of multiline textbox in the component design window.
    So, it's a big job to right align a poor clean half douzain of numbers in a box ! Any ideas ?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Only multiline textboxes support right aligned text (Windows Mobile OS limitation).
    When you change the alignment with FormLib it changes the textbox to a multiline textbox.
    Your code appears to be working properly.
    If you don't want to delete the text in textbox1 you can add TextBox1.IgnoreKey.
    Otherwise the carriage return characters will be added to textbox1.

    It may be a little bit confusing but in the designer you should change the text of a multiline text in the larger text field and not in the regular text field.
     
  3. dan kabestan

    dan kabestan Member Licensed User

    Textbox copy-in-list problem is always there.

    Right, the justify is multiline reserved, but the textbox copy-in-list problem is always there.

    How may i copy each textbox1.text content (catched by return keypress on it),
    in a visible go-down natural right-justified list, as multiline textbox ? (because no right justify in listbox)
    If we do only the single copy it's run, but,
    if we do a minimum operation after input on textbox1, before copy : textbox2 LOST the "linefeed" !
    (all chr(13) or (10) adds-cook on textbox2, generate a "dirty" small box beside numbers)
    What can i do for build a simple vertical scrolling list of numbers (right-justified!) ?
    Thanks for help.
     
    Last edited: Jan 18, 2008
  4. Erel

    Erel Administrator Staff Member Licensed User

    You should use the new-line constant crlf:
    Code:
    Sub Globals
        
    'Declare the global variables here.

    End Sub

    Sub App_Start
    Form1.Show
    dyn_form.New1(
    "Form1",B4PObject(1))
    dyn_form.TextAlignment(
    "TextBox1",dyn_form.alRight )
    dyn_form.TextAlignment(
    "TextBox2",dyn_form.alRight )
    textbox1.Text =
    "" : textbox2.Text =""

    End Sub
    Sub TextBox1_KeyPress (key)
    If key = Chr(13Then
    '-------------- test1 textbox1 modify -> the T2 list is OK
    'textbox1.Text = StrReplace(textbox1.Text,"5","x")
    '------------- test2 textbox1 modify -> linefeed is _lost_ in T2
    textbox1.Text = (textbox1.Text *2)
    '---------------------------------------------------------------------
    textbox2.Text = textbox2.Text & textbox1.Text & crlf
    textbox2.SelectionStart = StrLength(textbox2.Text)
    textbox2.ScrollToCaret
    textbox1.Focus
    textbox1.Text=
    ""
    End If
    End Sub
     
  5. dan kabestan

    dan kabestan Member Licensed User

    Bravo, with crlf at the good place the list now run.

    Notice the chr(13) & chr(10) run too ! But only in this order.
    All other config (i was tried!) fails .
    Thanks for the complete fast help.
     
Loading...