iOS Question Expected: JVFloatLabeledTextField, object type: UITextField in B4i

Pedro Caldeira

Active Member
Licensed User
Longtime User
Hello All,
I have a FloatLabeledTextField created by the designer, with several views, buttons, labels, etc.
Id the proprerties of on of the buttons I have the following code:
B4X:
Sub CLAButtonSearchText_Click
    Dim this As Button = Sender
    Dim pthis As Panel = this.Parent
    Dim ftxt As FloatLabeledTextField = pthis.Getview(3)
    Log(ftxt.tag)
    CLAButtonSearchTextCall(ftxt, this)
End Sub

I get a crash Error when I click it: Expected: JVFloatLabeledTextField, object type: UITextField

Why ? How can I solve it ?
 

Pedro Caldeira

Active Member
Licensed User
Longtime User
Why??? Switch to B4XFloatLabeledTextField from XUI Views.
Tip: you should never see "panel" in your code. Switch to B4XView. Simpler, cross platform and more powerful.
You mean "B4XFloatTextField" ? I cannot find "B4XFloatLabeledTextField"
 
Upvote 0

Pedro Caldeira

Active Member
Licensed User
Longtime User
strange that Tag does not work neither parent with a simple button using b4xview instead of panel and B4XFloatTextField, instead of FloatLabeledTextField. What could I be doing wrong?

B4X:
Sub CLAButtonSearchTextCall(this As B4XFloatTextField, othis As Button)
    ShareCode.isChapterSearch = False
    Dim pthis As B4XView = this.parent  <--- Error (Unknown member: parent)
End Sub

Sub CLAButtonSearchText_Click
    Dim this As Button = Sender
    Dim pthis As B4XView = this.Parent
    Dim ftxt As B4XFloatTextField = pthis.Getview(3)
    Log(ftxt.Tag)  <--- Error ([<B4IPanelView 0x109bfc360> valueForUndefinedKey:]: this class is not key value coding-compliant for the key _tag.)
    CLAButtonSearchTextCall(ftxt, this)
End Sub

How come a B4XFloatTextField does not have the parent property ?
I am sure that I am doing something wrong, but what?

B4X:
Dim this As B4XFloatTextField
Dim pThis As B4XView = this.parent <-- property does not exists

Even with mBase I get the same error ([<B4IPanelView 0x1261d26a0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key _mbase.)
in the code_
B4X:
Dim pThis As B4XView = this.mBase.parent

Can someone, please help ?
 
Last edited:
Upvote 0

Pedro Caldeira

Active Member
Licensed User
Longtime User
The tag issue is solved, but not the parent.
I have a simple declaration like that and it crashes.

B4X:
' *************************************************************
Sub CLAButtonSearchTextCall(this As B4XFloatTextField, othis As Button)

    ShareCode.isChapterSearch = False
    Dim pthis As B4XView = this.mBase.Parent <--Crashes HERE with the error below.
.....

ERROR : [<B4IPanelView 0x1297a5e30> valueForUndefinedKey:]: this class is not key value coding-compliant for the key _mbase.
 
Upvote 0

Pedro Caldeira

Active Member
Licensed User
Longtime User
Post the call to CLAButtonSearchTextCall.

You are missing a ".Tag" there.

B4X:
Sub CLAButtonSearchText_Click
    Dim this As Button = Sender
    Dim pthis As B4XView = this.Parent
    Dim ftxt As B4XFloatTextField = pthis.Getview(3)
    CLAButtonSearchTextCall(ftxt, this)
End Sub


a ".Tag" ? Where?
 
Upvote 0

Pedro Caldeira

Active Member
Licensed User
Longtime User
Ok,
But how can I still use the Tag property to set and retrieve text ?
and I cannot get ftxt parent nevertheless.
Only the mBase of FTxt has a parent property

B4X:
Dim FTxt As B4XFloatTextField = pthis.Getview(3).Tag
dim pThis as b4xView = FTxt.parent <- Property does not exists
 
Last edited:
Upvote 0

Pedro Caldeira

Active Member
Licensed User
Longtime User
You can store whatever you like in Ftxt.Tag.

Ftxt is not a view. Ftxt.mBase is the base view.
and beeing the base view, this:
B4X:
dim pThis as b4xView = FTxt.parent

should be replaced with this:

B4X:
dim mB as panel = FTxt.mBase
dim pThis as b4xview = mB.Parent

is that correct ?
 
Upvote 0
Top