Results 1 to 3 of 3

Thread: [Answers] Textbox

  1. #1
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,135

    [Answers] Textbox

    Q:
    textbox, uppercase
    A:
    recommended method is to do it as the data is entered using the @! input mask.

    Validation won't change the data that is entered, it simply validates the input.
    Default will not change the data either, it simply sets a default value when adding a new record.
    If you really did not want to use input masks you could use the Before Data Create and Before Data Update section delegates to change the data when updated
    You can't combine @ picture functions.



    Q:
    Dragging a numeric field onto a form produces a different field to dragging a numeric field onto a Canvas. The Canvas is a spinner. I don't want a spinner - how can I change it from a spinner?
    A:
    If you look under the advanced canvas controls there is a Numeric TexBox, you can use that and set the Data source if you don't want a spinner.



    You can actually use the 'returntabs' property on a textbox so that a return key is treated as a tab:
    Code:
    mytextbox.returntabs = 1
    This in turn will fire the valid and lostfocus events, so you could program either of those as required.



    Q:
    I would like the textbox to react like a label but displayed as a textbox, maybe with different forecolor and backcolor.
    A user should not be able to click into or to jumb by tab to the textbox, the text should not be selectable.
    That is what happens, when I set the Property ENABLED to .F. in VFP.
    A:
    You can set the enabled property for the textbox, for example in the Enabled When delegate:

    Code:
    ////////////////////////////////////////////////////////////////
    // Event delegate for 'enabledwhen' event
    proc page1_section1_field98_enabledwhen()
            this.enabled = .f.
    // or Lianja.get("field98").enabled = .f.
    endproc
    By default, the disabled field will be greyed out.



    Q:
    I want to bound a textbox to a variable
    A:
    It seems to need a refresh(). The following works:

    Code:
    define class xtextbox as textbox
            top = 0
            left = 0
            height = 20
            width = 200
            controlsource = "m.foo"
            name = "xtextbox"
    enddefine
    
    define class xform as form
            add object xtextbox1 as xtextbox
            name = "xform"
    enddefine
    
    private foo
    m.foo = "This is a Test"
    
    loForm = CreateObject("xform")
    loform.xtextbox1.refresh()
    loForm.Show(1)


    If you look at the field attributes you can adjust the font of the "Data" to be "Small", "Large", "Largest".
    You cannot make huge text boxes but you can do so with Labels.




    ​All topics in [Answers] alphabetically:http://www.lianja.com/community/show...ll=1#post12352
    Last edited by josipradnik; 2017-01-31 at 06:24.

  2. #2
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,135
    Q:
    I have imported a basic vfp form with 2 textboxes and 2 command buttons. Once imported the file shows the textboxes as having disabled back colour and disabled fore colour set. When I create a page from the imported form it ignores the disabled settings.
    A:
    By default, disabled fields are just greyed out. You can set the App 'Readonly fields backcolor' in the App Settings.



    Q:
    I am trying to hide a textbox upon data change of another textbox.
    A:
    visibleWhen attribute at the bottom of the formitem attributes under UI presentation rules.
    Note that for visibleWhen to be evaluated you must switch to runtime mode. In development mode it is not evaluated.




    Q:
    I have several textboxes displaying data on a canvas section. All are marked as not editable. Most of the information displayed is black. However, a couple are displayed in grey. Is there a reason for this? If I make the textbox editable, it turns black again.
    A:
    You can override the colors with the CSS attribute.

    E.g.
    background: ink;foreground:black;
    Controls that are disabled are slightly grayed out. That's a function of the Windows operating system.
    Are they different types of textbox (numeric, date etc.)



    Q:
    What is the best method for clearing the text value of a textbox element. I tried a few this such as the line below. The textbox is not linked to a variable
    blank(Lianja.Get("Start_Page.main_menu.enter_comma nd").text)
    A:
    Code:
    Lianja.Get("Start_Page.main_menu.enter_command").text = ""



    ​All topics in [Answers] alphabetically:http://www.lianja.com/community/showthread.php?2717-Answers



  3. #3
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,135
    Q:
    I cannot seem to find a way to remove the border of the data section of a textbox. See the white border around the Id data field. I am looking to have this a solid background with no border. Can anyone give me a little guidance. I have attached a screen capture of my attributes. All I see for border setting is under the caption setting and it is set to 0.



    A:
    To style an individual Canvas Section textbox:
    CSS style: background: blue; color: white; border: blue;
    Or to do all sections on a Page, edit the Page 'CSS Style' file:
    Code:
    lianja_ui_section * {
    background-color:blue;
    color:white;
    }
    
    lianja_ui_textbox {
    background: blue;
    color: white;
    border: blue;
    }
    (Or for all sections in the App, put it in the App 'App CSS style' file.)



    Q:
    Can I databind a textbox and/or comboBox to a table in a canvas section?
    Every time I click away from the item, the "Data source" of the items reverts to blank



    1) I try to put a textbox that shows a value from the first record of the table. I tried putting myTable.nThisField into the "Data source" of the item to no avail.
    2) I also tried a dropdown combobox populated from another table, also failed. So I set "choices" property. Still it fails to populate



    A:
    Check the actionbar at the bottom of the Attributes grid.
    When core attributes are edited, save and cancel (tick/cross) icons are displayed to confirm or abandon the change.



    Q:
    Possible to init a textbox with a default value eg. field1.value=123
    If yes, where should i put this code? I tried putting in section->init() / load()/ ready() without success.

    A:
    Put it in the Page ready().

    A2:
    Specifying a default value in Page.Init works only if the input text is not bind to a table field.



    "value"
    and "text" are synonymous.



    Q:
    A canvas section with 1 combobox "cbo1" and 3 textbox "txt1", "txt2", "txt3".
    cbo1, txt1, txt2 are bind to a table field source.
    tx3.value is computed depending on cbo1, txt1, and txt2 values.
    How do i achieve that during record navigation?

    A:
    put this calculation in section's DataChanged (After Data Changed) delegate
    The "Data Changed" delegate is called whenever you navigate between records.




    All topics in [Answers] alphabetically: https://www.lianja.com/community/sho...ll=1#post13748

    These answers are also systematized on the site "Lianja developer": https://lianjadeveloper.wordpress.com/category/textbox/

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us