Zeev Goldstein Well-Known Member Licensed User Longtime User Oct 28, 2013 #1 hi, i use a textbox for entering data. how do i prevent it from scroll when i enter a long string ? currently after i type in a long string it will scroll down, i want it to keep in one line it is not set to be multi line in the designer when i am typing it is fine - all in one line but when i move to another field it scrolls thanks
hi, i use a textbox for entering data. how do i prevent it from scroll when i enter a long string ? currently after i type in a long string it will scroll down, i want it to keep in one line it is not set to be multi line in the designer when i am typing it is fine - all in one line but when i move to another field it scrolls thanks
Erel B4X founder Staff member Licensed User Longtime User Oct 28, 2013 #2 Does your text include an end of line character? Upvote 0
Zeev Goldstein Well-Known Member Licensed User Longtime User Oct 28, 2013 #3 i think it has nothing to do with that as it also happen while i type basically the data is read from a magnetic card reader but even if i just press 4 or any other char for some time it will happen the msr finishes the entry with cr+lf but my manual entry is just charachters without any cr or lf in the end it is somehow dependent on the text box... Upvote 0
i think it has nothing to do with that as it also happen while i type basically the data is read from a magnetic card reader but even if i just press 4 or any other char for some time it will happen the msr finishes the entry with cr+lf but my manual entry is just charachters without any cr or lf in the end it is somehow dependent on the text box...
Erel B4X founder Staff member Licensed User Longtime User Oct 28, 2013 #4 Try this code: Code: Copy Dim r As Reflector r.Target = EditText1 r.RunMethod2("setHorizontallyScrolling", False, "java.lang.boolean") r.RunMethod2("setMaxLines", 1, "java.lang.int") EditText1.SingleLine = True Upvote 0
Try this code: Code: Copy Dim r As Reflector r.Target = EditText1 r.RunMethod2("setHorizontallyScrolling", False, "java.lang.boolean") r.RunMethod2("setMaxLines", 1, "java.lang.int") EditText1.SingleLine = True
Zeev Goldstein Well-Known Member Licensed User Longtime User Oct 29, 2013 #5 thanks Erel, i put this code in sub Globals it did not work it didn't produce any error but also didn't change anything have i missed anything ? thanks Upvote 0
thanks Erel, i put this code in sub Globals it did not work it didn't produce any error but also didn't change anything have i missed anything ? thanks
Erel B4X founder Staff member Licensed User Longtime User Oct 29, 2013 #6 You should put this code in Activity_Create. Sub Globals should only be used to declare variables. I tested it on Android 4.3 and it doesn't scroll. Also make sure that the EditText height fits a single line. Upvote 0
You should put this code in Activity_Create. Sub Globals should only be used to declare variables. I tested it on Android 4.3 and it doesn't scroll. Also make sure that the EditText height fits a single line.
Zeev Goldstein Well-Known Member Licensed User Longtime User Oct 29, 2013 #7 thanks. sorry - i tried in Activity_Create but then i get error that the edittext is not initialized... how do i set edittext height to fit single line ? the text size is 25 height is 50. tried 25, 35, 40, 45 but the text was set to upper changed to center and tried all options i could not set it to fit. when i leave the field it is shown a bit up so i see the first part above the second part also - when typing it cuts the entry and seems to start on clean but it is ok as the whole content is there very odd - it should scroll horizontally... edit: i can't even initialize the edittext as it is not yet declared... chicken and egg ? Upvote 0
thanks. sorry - i tried in Activity_Create but then i get error that the edittext is not initialized... how do i set edittext height to fit single line ? the text size is 25 height is 50. tried 25, 35, 40, 45 but the text was set to upper changed to center and tried all options i could not set it to fit. when i leave the field it is shown a bit up so i see the first part above the second part also - when typing it cuts the entry and seems to start on clean but it is ok as the whole content is there very odd - it should scroll horizontally... edit: i can't even initialize the edittext as it is not yet declared... chicken and egg ?
Zeev Goldstein Well-Known Member Licensed User Longtime User Oct 29, 2013 #8 solved. had to bypass the problem any way as the display had to hide part of the field so i use a display field that holds the relevant data to show and the full content is hidden in another non display field. thanks for your help and good will Upvote 0
solved. had to bypass the problem any way as the display had to hide part of the field so i use a display field that holds the relevant data to show and the full content is hidden in another non display field. thanks for your help and good will