Label.Text Problem

RFI Bill

Member
Licensed User
Longtime User
Hi there

Just created an app and the movement to go back and forward through different screens/layouts in a panel. Of my 3 layouts I have a splash screen, a menu screen with a listbox that gets populated, and a 3rd screen that has a few labels in it what display the Value of the users choice out of the Listview from the second window.

My problem is that when the user selects something to be displayed and I adjust the 3rd screens labels to reflect this and make the layout visible, and then the user goes back and makes another selection ....the labels on my third screen dont appear to be resetting their text, only they are almost drawing over the previous text to make the label appear jumbled and cluttered...after a few times going back and forth the labels look to be in Russian lol.

I am using Panel.visible method of going back and forth through the screens.

When setting text properties on a label after previously doing it do I need to invalidate the label or something? Im morbidly confused.

Cheers:sign0104:
 
Last edited:

Ricky D

Well-Known Member
Licensed User
Longtime User
Can you please post the code?

Put it between code tags - the # next to <> here

regards, Ricky
 
Upvote 0

RFI Bill

Member
Licensed User
Longtime User
This is the listview event. basically by this point the listbox has been populated and this is where the user selects a listview member and it uses that to query an sql database and sets up the next page accordingly.



B4X:
Sub lstviewResults_ItemClick (Position2 As Int, Value As Object)
Dim Buffer() As Byte 'declare an empty byte array
Dim InputStream1 As InputStream
Dim Cursor1 As Cursor
Dim Bitmap1 As Bitmap
Dim Myphone As Phone
Dim MP As MediaPlayer
   
   Myphone.HideKeyboard(Activity)
   ToastMessageShow("Displaying " & Value,False)
   MenuPanel.Visible = False
   SelectionPanel.LoadLayout("Selection")
   
   
   lblSelectionTitle.Text = Value

    Cursor1 = myDatabase.ExecQuery2("SELECT Pic FROM Rudiments WHERE Rudiments = ?",Array As String(Value))
    Cursor1.Position = 0
  
   Buffer = Cursor1.GetBlob("Pic")
    InputStream1.InitializeFromBytesArray(Buffer, 0, Buffer.Length)
    Bitmap1.Initialize2(InputStream1)
    InputStream1.Close
   ImgViewRudiment.SetBackgroundImage(Bitmap1)
    
    Cursor1 = myDatabase.ExecQuery2("SELECT Sticking FROM Rudiments WHERE Rudiments = ?",Array As String(Value))
   Cursor1.Position = 0

   LblSticking.Text = Cursor1.GetString("Sticking")
   
   Cursor1.Close
   
   SelectionPanel.Visible = True
   
End Sub
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
You should move this line
B4X:
SelectionPanel.LoadLayout("Selection")
from the ListView routine to Activity_Create.
When you load a layout file all the views are added to the existing layout so each time you select an item in the ListView you add a new layout.

Best regards.
 
Upvote 0
Top