Android Question Class access in B4XPages

Levit

Member
Licensed User
Longtime User
Hi Everyone!

I have an app with several pages (using TabstripViewpager) and it uses my custom class
that is a special keyboard, accessed in every page.

Starting now with B4xPages I want to include several more pages in that app.
I declared "Public kbd as MySpecialKbdClass" in main activity and loaded it in main layout
but I can not open the keyboard from each B4xpage.

I have searched about it in B4XPages but the only way I can access "kbd" in each B4XPage is declaring
"Private kbd as MySpecialKbdClass" in every B4XPage and loading it in every layout of each B4xPage.

I am repeating myself.
Is this the right way to do it? ... Or am I missing something?

Thanks!
 

Levit

Member
Licensed User
Longtime User
Thank you Erel!
I also tried declaring it in B4XMainPage but I guess I was calling it in wrong way.

let me try " B4XPages.MainPage.kbd.DoSomething "
 
Last edited:
Upvote 0

Levit

Member
Licensed User
Longtime User
Yes, I was calling it in wrong way.
" B4XPages.MainPage.kbd.DoSomething " works.

But my problem still persists.
Say I am at "page 9" and I call " B4XPages.MainPage.kbd.DoSomething ".
The keyboard will appear in "B4XMainPage", But I need it in "page 9".

So, what is the best to do?
Should I declare it in each page or there is another way?

thanks.
 
Upvote 0

Levit

Member
Licensed User
Longtime User
B4X:
B4XPages.MainPage.kbd.DoSomething  (Root)
In DoSomething, remove the top panel from its parent (B4XView.RemoveViewFromParent) and add it to Root.

Other options are also good.



If I understand it right I can call form any page, for example :
B4X:
B4XPages.MainPage.kbd.ShowKbd  (Root)
And the keyboard will appear in the page I called it from.

To achieve this I need to :
" remove the top panel from its parent (B4XView.RemoveViewFromParent) and add it to Root. " <------ But Where should I do this?

In DoSomething ???? or Showkbd????

Sorry, but I don`t understand where and which top panel are we talking about.
Add to Root ..... In Main or B4XMainPage?

thank you
 
Upvote 0

Levit

Member
Licensed User
Longtime User
That's OK.
Knowing that "DoSomething" is actually the right direction I can, eventually, work it out.


The important thing to remember is that B4XPages classes are regular classes. You can put the code wherever you like. It doesn't matter.

That's an important tip.


By the way..... B4Xpages should be called "B4XAwesomePages".

Thank you Erel.
 
Upvote 0
Top