Wish Adding B4XPage_KeyPress as a default

Peter Simpson

Expert
Licensed User
Longtime User
Hello Anywhere Software,
I personally think that this is a good idea, but hey I started this sentence off with I as if I'm the only person here that matters 🤣, I'm just kidding.

Anyway, for some reason I expected that a B4XPage project would have B4XPage_KeyPress already, but it doesn't. B4XPage_KeyPress has to be added manually.

I would like to see the following added as default.

'Change Activity_KeyPress to the following default (B4A)
Default code block:
Sub Activity_KeyPress (KeyCode As Int) As Boolean
    'Return B4XPages.Delegate.Activity_KeyPress(KeyCode)

    If KeyCode = KeyCodes.KEYCODE_BACK Then
        Return B4XPages.Delegate.Activity_KeyPress(KeyCode)
    End If

    B4XPages.GetManager.RaiseEvent(B4XPages.GetManager.GetTopPage, "B4XPage_KeyPress", Array(KeyCode))
    Return False
End Sub

'Add the B4XPage_KeyPress as an auto-generate event sub (B4A)
Auto generate B4XPage_KeyPress:
Private Sub B4XPage_KeyPress (KeyCode As Int) As Boolean

There's probably a really good obvious logical reason that I've missed why these are not already default (B4X), I just currently can't think of it, it's probably a cross platform thing ;)


Thank you...
 

LucaMs

Expert
Licensed User
Longtime User
I guess most of the time we don't need it.
Just some comment lines in my project template (B4XMainPage), thanks to @klaus too:
B4X:
'Open another IDE.
'B4A ide://run?file=%WINDIR%\System32\cmd.exe&Args=/c&Args=start&Args=..\..\B4A\%PROJECT_NAME%.b4a
'B4i ide://run?file=%WINDIR%\System32\cmd.exe&Args=/c&Args=start&Args=..\..\B4i\%PROJECT_NAME%.b4i
'B4J ide://run?file=%WINDIR%\System32\cmd.exe&Args=/c&Args=start&Args=..\..\B4J\%PROJECT_NAME%.b4j

'Opens the project folder.
'Project folder: ide://run?file=%WINDIR%\SysWOW64\explorer.exe&Args=%PROJECT%

I also have all the Regions I like, an additional B4XPage (also with Regions and more), a normal class, a project module for project utilities, ...!

But I plan to improve it 😊
 
Top