Android Question Sure there is a simple solution, but...

craigc

Member
I am still very new with B4X, but I think there must be a simple solution to my issue(s) since I think I have copied code from other answers in the Forum. I do not understand why "initialize" and "showtemplate" are "unknown members". Additionally, when I initialize the etInputTemplate, the log error thinks I have an array. I'm sure I have left something(s) out, since the code itself looks to me like quite a few examples I have found in my searches. Have I shown enough for someone to spot my errors? Thanks in advance!! Very much appreciated!!

B4X:
Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
    Private etInputTemplate As B4XInputTemplate
    Private btnQuit As B4XView
    Private btnSubmit As B4XView
    Private etNoRemem As B4XView
    Private memberID As Int

End Sub

'This event will be called once, before the page becomes visible.
Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root1.LoadLayout("MainPage")
    B4XPages.GetManager.LogEvents = True
    Dim etInputTemplate As B4XInputTemplate
    etInputTemplate.Initialize("etID_ClickProcess")
    
End Sub

Sub etID_ClickProcess
    Dim etID As EditText = etInputTemplate.TextField1
    etInputTemplate.ConfigureForNumbers(True, True)  'no decimals and no negatives
    etInputTemplate.lblTitle.Text = "Enter your OGS ID with 1 to 4 digits - leading zeros unnecessary"
    Wait For (DialogResponse.ShowTemplate(etInputTemplate, "OK", "", "CANCEL")) Complete (Result As Int)
    If Result = xui.DialogResponse_Positive Then
        Log(etInputTemplate.text)
        memberID = etInputTemplate.text
    End If
    
End Sub

Private Sub btnQuit_Click
    B4XPages.GetNativeParent(Me).Finish
End Sub
 

craigc

Member
Yes. I have checked off Xui, Xui Views and B4XPages libraries. I got the same result in B4A 11.0 and after I installed B4A 11.20 Beta #1.
 
Upvote 0

craigc

Member
The attached is from "Files/Export as Zipped". Not sure if that gives you everything, but I did not see a similar option within Developer.
 

Attachments

  • OurGolfStats App v5.zip
    10.5 KB · Views: 94
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Not sure if that gives you everything,
Here is the way the full B4XPages code should be using your layout. Your project has lots of mistakes , SoI am including the full one here. Sorry Erel, I was ready to post the full project.
B4X:
#Region Shared Files
'#CustomBuildAction: folders ready, %WINDIR%\System32\Robocopy.exe,"..\..\Shared Files" "..\Files"
'Ctrl + click to sync files: ide://run?file=%WINDIR%\System32\Robocopy.exe&args=..\..\Shared+Files&args=..\Files&FilesSync=True
#End Region

'Ctrl + click to export as zip: ide://run?File=%B4X%\Zipper.jar&Args=Project.zip

Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
    Private etInputTemplate As B4XInputTemplate
    Private btnQuit As B4XView
    Private btnSubmit As B4XView
    Private etNoRemem As B4XView
    Private memberID As Int
    Private Dialog As B4XDialog
End Sub

Public Sub Initialize
End Sub

'This event will be called once, before the page becomes visible.
Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root1.LoadLayout("MainPage")
   
    Dialog.Initialize (Root)
    etInputTemplate.Initialize
   
    B4XPages.GetManager.LogEvents = True   
End Sub

Sub etID_Click
    etInputTemplate.ConfigureForNumbers(True, True)  'no decimals and no negatives
    etInputTemplate.lblTitle.Text = "Enter your OGS ID with 1 to 4 digits - leading zeros unnecessary"
    Wait For (Dialog.ShowTemplate(etInputTemplate, "OK", "", "CANCEL")) Complete (Result As Int)
    If Result = xui.DialogResponse_Positive Then
        Log(etInputTemplate.text)
        memberID = etInputTemplate.text
        Log(memberID)
    End If   
End Sub

Private Sub btnQuit_Click
    B4XPages.GetNativeParent(Me).Finish
End Sub
 
Upvote 1

craigc

Member
Here is the way the full B4XPages code should be using your layout.

@Mahares Thank you very, very much. After many, many hours of trial and error, reviewing documentation and others questions and responses - I was about to give up. I now have a working example that I will study to ensure that I understand exactly what is in the code and why. It appears that trial and error, the booklets, the tutorials, the videos, and the Forum are how everyone is learning the language.

I have been using the book B4A - Rapid Android App Development Using BASIC by Wyken Seagrave as my main source. It looks like it was originally published in 2015 for B4A 4.3 and revised in March 2021 for B4A 10.60. THE 700 PAGE BOOK IS EXCELLENT. The B4A language seems to be continually expanded with new capabilities. I know I will never be an expert with this language, but I do plan to learn the basics better and learn how to use specific capabilities. I realize that I have been "mixing and matching" different coding solutions that resulted in many errors. Thank you again for helping me get past this problem and back to studying for the next features that I will be adding. This is very much appreciated!!
 
Upvote 0
Top