_Click on TabHost not working for me

rleiman

Well-Known Member
Licensed User
Longtime User
On a TabHost view I found there are 3 events. Click, LongClick and TabChanged. I found that only TabChanged works and I would like to use Click since the user may tap a tab and go back to the home screen and may want to tap the same tab again.

Here is the Sub Routine I used with TabChanged, but I would like to use Click instead. Maybe I need to change something in my code other than just changing the _TabChanged to _Click. If so, could you let me know what to change?

Code: Copy
Sub tbhPagesEventHandler_TabChanged

    ToastMessageShow(tbhPages.CurrentTab,False)

    ' These will make the code easier to read.
    '-----------------------------------------
    Dim intVisitsTab As Int : intVisitsTab = 0
    Dim intMaintenanceTab As Int : intMaintenanceTab = 1

    ' Start the activity the user wants.
    '-----------------------------------
    Select tbhPages.CurrentTab

        Case intVisitsTab
            StartActivity("Visits")

        Case intMaintenanceTab
            StartActivity("Maintenance")
    End Select
End Sub

Thanks.
 
Ok. I see what you mean because I was clicking on the tabs.

I noticed if I use TabChanged nothing happens if you click on the tab that already has focus on it but the other tab works that has no focus.

If the TabHost view is the only view on the screen, is there a way to take focus off the Tabs or TabHost using code?
 
Upvote 0
Hi Erel,

I'm looking to have the TabHost displayed when the app is run then allow the user to tap one either the "Visits" or the "Maintenance" tab.

Currently when the app is run, the user can only tap on the "Maintenance" tab and the TabChanged event will fire. It won't fire if the user taps on the "Visits" tab. I think this is happening because focus is currently on the "Visits" tab the first time the app is run.

If I can somehow release focus on the TabHost or not have any tab as the current tab maybe the TabChanged event will fire when the user clicks on the "Visits" tab.
 
Upvote 0
Back
Top