AHViewPager

tomoshea

Member
Licensed User
Longtime User
Hi,
I have a problem with the AHViewPager.
I have compiled a simple example of the problem.
I have a layout with 2 scrollviews residing on a panel.
I load page 0 and Page 1 with this layout.
I then load the scrollview panels as per code below.

Code
Sub Process_Globals
Dim TYPE_PAGE1 As Int : TYPE_PAGE1 = 1
Dim TYPE_PAGE2 As Int : TYPE_PAGE2 = 1
.....

in Sub Activity_Create
'Initialize the panels we use for the pages and put them in the container
container.Initialize
For i = 0 To 1
Dim pan As Panel

Select i
Case 0
pan = CreatePanel(TYPE_PAGE1, "Page 1")
container.AddPage(pan,"Page " & i)
Case 1
pan = CreatePanel(TYPE_PAGE2, "Page 2")
container.AddPage(pan,"Page " & i)
End Select
Next

'Now we have a container with our panels just add it to the pager object
pager.Initialize(container, "Pager")
......

'This creates a page of the given type
Sub CreatePanel(PanelType As Int, Title As String) As Panel
Dim pan As Panel
Dim pi As PanelInfo

pi.Initialize
pi.LayoutLoaded = False
pi.PanelType = PanelType

pan.Initialize("")
Select PanelType
Case TYPE_PAGE1
pan.LoadLayout("main8")
sv0.Panel.LoadLayout("f2panel")
sv0.Panel.Height = 100%y
sv1.Panel.LoadLayout("f0panel")
sv1.Panel.Height = 100%y
Case TYPE_PAGE2
pan.LoadLayout("main8")
sv0.Panel.LoadLayout("f2panel")
sv0.Panel.Height = 100%y
sv1.Panel.LoadLayout("f0panel")
sv1.Panel.Height = 100%y
End Select

pan.Tag = pi
Return pan
End Sub

Problem
If I am on Page 0 and I click a checkbox then the code in the CheckedChange event is executed but the changes do not happen.
If I am on page 1 and I do the same thing everything works perfectly.
I am attaching an example.
Any help would be greatly appreciated.
Thank you,
Tom
 

Attachments

  • AHViewPagerTest.apk
    259.6 KB · Views: 212

tomoshea

Member
Licensed User
Longtime User
Hi corwin42,
Can you have a look at this please and let me know if there is a way to fix the problem.
I am probably doing something very stupid.
Thanks
Tom
 
Upvote 0

corwin42

Expert
Licensed User
Longtime User
Please use the CODE Tags for your source code in the forum. It's much better to read.

You haven't posted the relevant part of your code, the CheckedChange event sub.
Best would be if you could post your complete example project (In the IDE select File->Export as zip).
 
Upvote 0

tomoshea

Member
Licensed User
Longtime User
Hi corwin42,
Thanks for the replay - sorry for not posting the code.
Code to example now attached.
Kind Regards,
Tom
 

Attachments

  • AHViewPagerTest.zip
    12.1 KB · Views: 184
Upvote 0

corwin42

Expert
Licensed User
Longtime User
You load the same layout files for both pages so the variables for the controls in the layout will hold a reference to the controls on the second page only. No matter on which page you are the controls are only modified on the second page.
 
Upvote 0
Top