iOS Question Solved - I don't understand what to put for page reference when initializing things

tsteward

Well-Known Member
Licensed User
Longtime User
I have come across this a few times and I just don't understand.
On this occasion I am looking at the using the camera to choose an image but I always get errors on the second parametre.
cam.Initialize("cam", Page1)
I have tried Root, Me, B4XPages.MainPage.FeedbackEditorPage

My code is like this and I want to initialise cam on the feedbackeditorpage.
What do I put as the second parametre please

B4XMainPage:
Sub Class_Globals
    Dim carmodelpage As CarModels
    Dim toolPage As Tool
    Dim carPage As Car
    Dim codeSearchPage As CodeSearch
    Dim transponderPage As Transponders
    Dim addVehiclePage As addVehicle
    Dim FeedbackEditorPage As FeedbackEditor
end sub

Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    drawer.Initialize(Me, "Drawer", Root, 200dip)
    drawer.CenterPanel.LoadLayout("MainPage")
    carmodelpage.Initialize
    toolPage.Initialize
    carPage.Initialize
    codeSearchPage.Initialize
    transponderPage.Initialize
    addVehiclePage.Initialize
    FeedbackEditorPage.Initialize
    B4XPages.AddPage("model page",carmodelpage)
    B4XPages.AddPage("tool page",toolPage)
    B4XPages.AddPage("Car Page",carPage)
    B4XPages.AddPage("Code Search",codeSearchPage)
    B4XPages.AddPage("Transponder Page",transponderPage)
    B4XPages.AddPage("Add Vehicle Page",addVehiclePage)
    B4XPages.AddPage("Feedback Editor Page",FeedbackEditorPage)
end sub

FeedbackEditorPage:
Sub Class_Globals
    Private Root As B4XView 'ignore
    Private xui As XUI 'ignore
    Private B4XFTFeedback As B4XFloatTextField
    Private btnAddImage As SwiftButton
    Private cam As Camera
end sub

Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    'load the layout to Root
    Root1.LoadLayout("FeedbackEditorLayout")
    Dim p As B4XView = xui.CreatePanel("")
    p.SetLayoutAnimated(0, 0, 0, 1dip, 1dip)
    cvs.Initialize(p)
    #if B4A
    AddMenuItem(0xF0C7, "save")
    'AddMenuItem(0xF1C5, "image")
    #end if
    #if b4i
    cam.Initialize("cam", XXX What Goes Here XXX)
    #end if
    B4XFTFeedback.TextField.SetTextAlignment("TOP", "LEFT")
    dialog.Initialize(Root)
    dialog.BlurBackground = True
End Sub
 
Solution
Okay so the answer to my question on "What Goes Here" is
B4XPages.GetNativeParent(Me) to get the current page.

giving you
cam.Initialize("cam",B4XPages.GetNativeParent(Me))

Erel

B4X founder
Staff member
Licensed User
Longtime User
 
Upvote 0

tsteward

Well-Known Member
Licensed User
Longtime User
Okay so the answer to my question on "What Goes Here" is
B4XPages.GetNativeParent(Me) to get the current page.

giving you
cam.Initialize("cam",B4XPages.GetNativeParent(Me))
 
Upvote 0
Solution
Top