Timer and Ticks problem. Sender?

Malky

Active Member
Licensed User
Longtime User
I have scrollview and can get the value which is ll I need and then it's made invisible. However, the user doesn't see anything after selection, I would like it to change colour and back as normal lists do but can't get the selected panel to change?

I've tried various things, but keep getting errors.

I want to be able to use the same function for about 5 scrollviews that I will create. Is this possible?

Malky
B4X:
Sub pnlLanguage_Click
   Dim pnl As Panel
   Dim lbl As Label
   Log("Clicked")
   pnl = Sender                     ' gets the Panel at the selected row
   lbl = pnl.GetView(1)         ' gets the Label of the selected row
   ' here you can add the code you want
   
   ' lbl.Tag = language abdreviation
   Activity.Title = lbl.Tag   ' gets the Tag value of the Label
   PopulateDiction(lbl.Tag)
   language = lbl.Tag
   'Log("Dict = " & DictionList)
   'ToastMessageShow(DictionList.GetValueAt(2), True)
   SQL1.ExecNonQuery("UPDATE system SET value = '" & lbl.tag & "' WHERE var='language'")
   PanelTimer.Enabled = True
   
   'PanelTimer_Tick
   

   pnl.Color = Colors.Black
   'scvMain.Panel.Visible= False
End Sub
Sub PanelTimer_Tick
   Dim pnl As Panel
   'pnl = Sender                     ' gets the Panel at the selected row
   'pan = pnl.GetView(1)
   pnl.Color = Colors.Blue
End Sub
 

klaus

Expert
Licensed User
Longtime User
You can Dim a Global variable Dim CurrentPanel As Panel.

Then
B4X:
Sub pnlLanguage_Click
    Dim lbl As Label
    Log("Clicked")
    CurrentPanel = Sender                            ' gets the Panel at the selected row
    lbl = CurrentPanel.GetView(1)            ' gets the Label of the selected row
    ' here you can add the code you want
    
    ' lbl.Tag = language abdreviation
    Activity.Title = lbl.Tag    ' gets the Tag value of the Label
    PopulateDiction(lbl.Tag)
    language = lbl.Tag
    'Log("Dict = " & DictionList)
    'ToastMessageShow(DictionList.GetValueAt(2), True)
    SQL1.ExecNonQuery("UPDATE system SET value = '" & lbl.tag & "' WHERE var='language'")
    PanelTimer.Enabled = True

    CurrentPanel.Color = Colors.Black
    'scvMain.Panel.Visible= False
End Sub

Sub PanelTimer_Tick
    CurrentPanel.Color = Colors.Blue
End Sub
I want to be able to use the same function for about 5 scrollviews that I will create. Is this possible?
Yes, if the ScrollViews are in the same Activity.

Best regards.
 
Upvote 0

Malky

Active Member
Licensed User
Longtime User
Hi Klaus, thanks for that, but I can't see any change in colour before the scrollview is made invisible?

I just want a normal selected action/event before moving on to the next scrollview/list so that the user knows what they selected (just in case of error).

The default Blue is yuk by the way :)

Malky
 
Upvote 0

Malky

Active Member
Licensed User
Longtime User
Hi Klaus, zip file attached. I'm quite limited to what I can do now as I'm at work.

Cheers,

Malky
 

Attachments

  • scrollview2.zip
    18.8 KB · Views: 212
Upvote 0

Malky

Active Member
Licensed User
Longtime User
Hey, Klaus, great. Once again thank you very much.

I'll shorten the time a little I think and change that ugly colour, but brilliant.

Sorry for the delay in answering, I was lucky to get home tonight through the snow.

Have a good evening,

Malky
 
Upvote 0
Top