B4J Question [ABMATERIAL] Setting an ABMLabel as clickable doesn't work inside ExtraContent(?)

Cableguy

Expert
Licensed User
Longtime User
Hi guys

I have this code...

B4X:
    MenuContainerButton4Label1.Initialize( AppPage, "menucontainerbutton4label1", "{B}{I}Contactez-nous{/I}{/B}", ABM.SIZE_Small, False, "MenuContainerButtonTitle")
    MenuContainer.Cell( 4, 1).AddComponent( MenuContainerButton4Label1)
    MenuContainerButton4Label1.Clickable = True
In which MenuContainer is an ABMContainer inside a NavigationBar.ExtraContent.
I use the same approach all across my webapp, and this seems to be the only place where it doesn't fire.

I guess I will have to change them to Flat Buttons, but before going there, just inquiring if anyone else had this?
 

Harris

Expert
Licensed User
Longtime User
Sub Page_ParseEvent(Params As Map)
Dim eventName As String = Params.Get("eventname")
Dim eventParams() As String = Regex.Split(",",Params.Get("eventparams"))

Log("P_PE: "&""&" - "&Params)


So what you are stating is the above shows nothing?

I have not use labels in the NavigationBar.ExtraContent as clickable buttons, but shall test.
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
P_PE: - (MyMap) {eventparams=target, eventname=extrabutton_clicked, target=extrabutton} - the extra content button...
P_PE: - (MyMap) {eventparams=target, eventname=slide1_clicked, target=extracontent-slide1} - the label called slide1
slide1 clicked target: extracontent-slide1 ' - the sub slide1_clicked (target as String) log result....

B4X:
Sub slide1_clicked(target As String)
    
    Log(" slide1 clicked target: "&target)

End Sub


' ConnectPage

    Dim slide1 As ABMLabel
    slide1.Initialize(page, "slide1", "Select 10 Records (fore / after)", ABM.SIZE_H6 ,False, "")
    slide1.Clickable = True
    page.NavigationBar.ExtraContent.Cell(2,5).AddComponent(slide1)
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
Sub Page_ParseEvent(Params As Map)
Dim eventName As String = Params.Get("eventname")
Dim eventParams() As String = Regex.Split(",",Params.Get("eventparams"))

Log("P_PE: "&""&" - "&Params)
Yes I would try this first too. As it is a label in a container in an extra content, maybe the event name does contain the container name. If so, it may be possible to catch that in the ParseEvent and clean it back to 'menucontainerbutton4label1' before continuing.

Alwaysbusy
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
As it is a label in a container in an extra content, maybe the event name does contain the container name

That is EXACTLY why I log the parsed map - when developing.

The click is being raised, but not what you might expect.
As @alwaysbusy released a new version - the params may have changed - so I had to go back and fix my code... No big deal.

The deeper you go into a page, container, container within a container, modalsheet, etc... the more complex it becomes...
It is a bloody wonder it works at all! Yet it does, thru all the convolution (follow the page parse event sub log).
For me - beats the alternatives....
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Hi guys,

Indeed, I am logging in the Page_ParseEvent but only the "eventname" part... and nothing is being fired when I click the Label.
I made a tryout using a button and found 2 things...
The visual aspect is not what I am looking for an I seem to not to have how to make it so.
The buttons default cursor (hand) only appears in the very low edge of the button, line in the last 1 or 2 pixels rows. Clicking while the hand cursor is visible does fire the buttons event, but clicking anywhere else on the button, even in the dead middle, does nothing.
I must add, that I am trying to use all this in AppPage... maybe it's a limitation of some kind...
I will also try to reduce the child containers to the bare minimum. Will let you guys know later today.
 
Upvote 0
Top