Bug? [FIXED] Can not assign TextView.SelectionStart

JackKirk

Well-Known Member
Licensed User
Longtime User
This is a major problem for my app, any chance of a NativeObject workaround if a quick fix is not possible?

I have attached a simple little example which when you attempt to compile it in debug mode produces this error message from the remote compiler:

bug.jpg


B4X:
'Code module
#Region  Project Attributes
    #ApplicationLabel: B4i Example
    #Version: 1.0.0
    'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
    #iPhoneOrientations: Portrait, LandscapeLeft, LandscapeRight
    #iPadOrientations: Portrait, LandscapeLeft, LandscapeRight, PortraitUpsideDown
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'Public variables can be accessed from all modules.
    Public App As Application
    Public NavControl As NavigationController
    Private Page1 As Page
 
    Private Textview1 As TextView

End Sub

Private Sub Application_Start (Nav As NavigationController)
    NavControl = Nav
    Page1.Initialize("Page1")
    Page1.Title = "Page 1"
    Page1.RootPanel.Color = Colors.White
    NavControl.ShowPage(Page1)
End Sub

Private Sub Page1_Resize(Width As Int, Height As Int)
    Textview1.Initialize("")
    Page1.RootPanel.AddView(Textview1, 0, 0, 200, 200)
    Textview1.Text = "rubbish and gunk"
    Dim x As Int
    x = 3
    Textview1.SelectionStart = x
End Sub

Private Sub Application_Background
 
End Sub
 

Attachments

  • Test4.zip
    927 bytes · Views: 226
Last edited:

JackKirk

Well-Known Member
Licensed User
Longtime User
Erel,

Thanks for your speedy response - happy to wait till next week.

I feel a couple of comments are in order:
  • A huge project like you have undertaken inevitably has problems with consistency - both in the product and documentation (which in my view is a major part of the product, not an afterthought).
  • Consistency is important because it allows the user to extrapolate - with the result he doesn't have to rely so heavily on the documentation (it gets a bit circular).
  • In the case of B4A/B4I consistency between the platforms also greatly aids porting an app from one platform to the other - something that you are obviously attempting to make as easy as possible.
  • Elsewhere in B4A/B4I there are "properties" that only return a value where the in-line documentation clearly says "...read only" - B4I.TextView SelectionStart's in-line documentation says "Returns the text selection start index" - in hindsight it infers what you say but to me is ambiguous given the other documentation.
  • In B4A.EditText there is no SetSelection, only SelectionStart with in-line documentation that says "Gets or sets the selection start position (or the cursor position). Returns -1 if there is no selection or cursor." - incidentally this "gets or sets" approach is very much that of MS VB.
  • So for consistency could I suggest that your v2.50 B4I.TextView SelectionStart/SetSelection becomes simply SelectionStart as per B4A.EditText - with the same in-line documentation.
Probably more than most, I have a fair idea of the pressures you are under - but you will be doing yourself a major disservice in the long run if you let additional functionality prevail over consistency and documentation.

My appreciation for what you have done and are doing continues to grow...

P.S. I hope the above comments are consistent :).
 
Last edited:

JackKirk

Well-Known Member
Licensed User
Longtime User
Just installed B4I V2.50 with TextView.SelectionStart - all works.

Thanks...
 
Top