Hi all,
i am looking for a solution to access the parent of a Label to get the lblCounter.Text Value to change that label (lblCounter.Text).
Following the examples from the Forum i use the following code to retrieve which Label (plus or minus) was clicked.
The Button belongs to the same parent(=panel) as the lblCounter.
I thought a solution like this could work, but it does not:
I hope my question is clear ?
1 parent = panel holds 3 labels (1 should be minus, 1 should be plus, 1 is the counter)
Click on the Minus/Plus Label should change the counter.
Thanks for sharing any idea and/or example how to achieve this
Cheers Bernd
i am looking for a solution to access the parent of a Label to get the lblCounter.Text Value to change that label (lblCounter.Text).
Following the examples from the Forum i use the following code to retrieve which Label (plus or minus) was clicked.
B4X:
Sub minus_click
Dim sid As Int
Dim btnMinus As Label
btnMinus = Sender
sid = btnMinus.Tag
ToastMessageShow("Minus Nr clicked "&sid,False)
End Sub
The Button belongs to the same parent(=panel) as the lblCounter.
I thought a solution like this could work, but it does not:
B4X:
Sub minus_click
Dim btnMinus As Label
Dim parent as Parent '<-- Any Idea how to access the parent (a Panel) of btnMinus??
parent = btnMinus.parentView '<-----Parent is a Panel that holds all labels
t = parent.GetView(2) ' <--- lblCounter
counter = t.Text
t.Text = counter - 1 '<---
End Sub
I hope my question is clear ?
1 parent = panel holds 3 labels (1 should be minus, 1 should be plus, 1 is the counter)
Click on the Minus/Plus Label should change the counter.
Thanks for sharing any idea and/or example how to achieve this
Cheers Bernd