B4J Question [ABMaterial] Switching page requires clicking menu option two times

toby

Well-Known Member
Licensed User
Longtime User
I use the demo project inside this post

The only thing I changed was to comment out the following line of code which caused "unknown method" and which should be removed based on the accompanying comment.
commented out code:
    ' turn this mis-guided feature OFF - doesn't play well with others....  will be removed in future updates...
    ABM.EnablePassiveEventListeners=False

I've noticed that to switch to a different page, I need to click the corresponding menu option two times, not a single double-click. Below are logs shown when I tried to goto About page from ABMPageTemplate. It should be done in a single click; could someone kindly show me what was wrong and how to fix it?
Logs after first click:
 *** Page Event name: page_navigationbarclicked  (MyMap) {eventparams=action,value, action=About, value=../AboutPage, eventname=page_navigationbarclicked}
Waiting for value (4 ms)
Disconnected
Connected
Waiting for value (1 ms)
UpdateFromCache: ABMPageTemplate8e63b50a-6568-439a-be2e-7f280c693b2d
Saving the first instance
Waiting for value (2 ms)
Websocket first connection
Waiting for value (6 ms)
  -- This Page ID: ABMPageTemplate8e63b50a-6568-439a-be2e-7f280c693b2d
logs after second click:
 *** Page Event name: page_navigationbarclicked  (MyMap) {eventparams=action,value, action=About, value=../AboutPage, eventname=page_navigationbarclicked}
Waiting for value (5 ms)
Disconnected
Connected
Waiting for value (0 ms)
UpdateFromCache: AboutPage8e63b50a-6568-439a-be2e-7f280c693b2d
Saving the first instance
Waiting for value (1 ms)
Websocket first connection
Waiting for value (3 ms)
  -- This Page ID: AboutPage8e63b50a-6568-439a-be2e-7f280c693b2d
 *** Page Event name: page_visibilitystate  (MyMap) {eventparams=state, state=hidden, eventname=page_visibilitystate}
 
Solution
The problem is in the NavigateToPage and NavigateToPageNewTab methods. Remove the ws.close statements in both methods. This is probably something that has changed since 2018 (or with jServer 4).

Alwaysbusy

toby

Well-Known Member
Licensed User
Longtime User
Further testing results on Windows 10 64-bit:
1. Firefox and Edge works
2. Chrome and Opera still have this problem.
 
Last edited:
Upvote 0

toby

Well-Known Member
Licensed User
Longtime User
Test results on phones:
1. Google pixel 4A: Chrome failed while the other 3 worked.
2. Samsung Galaxy A11: Chrome and Edge failed while the other 2 worked.

Has anyone have similar experience?
 
Upvote 0

toby

Well-Known Member
Licensed User
Longtime User
After the first click, the logs indicates that it tried to load the current page (ABMPageTemplate) by mistake for unknown reason, if I understand it correctly.
B4X:
UpdateFromCache: ABMPageTemplate8e63b50a-6568-439a-be2e-7f280c693b2d
 
Upvote 0

mmieher

Active Member
Licensed User
Longtime User
The problem is in the NavigateToPage and NavigateToPageNewTab methods. Remove the ws.close statements in both methods. This is probably something that has changed since 2018 (or with jServer 4).

Alwaysbusy
There were hours of self-hate before I realized that clicking twice got me to where I wanted to be.

I am new and thought I had latest ABMExtras.zip, but needed to comment out those "ALSO NEW 4.00" lines.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
BTW, @alwaysbusy, this update is not applied into a new ABMServer.b4xlib v.1.07
 
Last edited:
Upvote 0
Top