AlpVir Well-Known Member Licensed User Longtime User Aug 30, 2023 #1 I'm editing the Camera2 project https://www.b4x.com/android/forum/threads/camera2-still-images-and-videos.83920/ which is made up of 3 "elements" : - Main - B4XMainPage - CamEx2. I would need to launch the CaptureVideo sub (which is in B4XMainPage) from Main. Precisely here : B4X: Sub Activity_KeyPress (KeyCode As Int) As Boolean If KeyCode=24 Then Log ("CAPTURE VIDEO") ' ????????????????????? End If 'Return B4XPages.Delegate.Activity_KeyPress(KeyCode) End Sub I don't know B4XPages well yet so I can't get what I want. Any help will be appreciated
I'm editing the Camera2 project https://www.b4x.com/android/forum/threads/camera2-still-images-and-videos.83920/ which is made up of 3 "elements" : - Main - B4XMainPage - CamEx2. I would need to launch the CaptureVideo sub (which is in B4XMainPage) from Main. Precisely here : B4X: Sub Activity_KeyPress (KeyCode As Int) As Boolean If KeyCode=24 Then Log ("CAPTURE VIDEO") ' ????????????????????? End If 'Return B4XPages.Delegate.Activity_KeyPress(KeyCode) End Sub I don't know B4XPages well yet so I can't get what I want. Any help will be appreciated
AlpVir Well-Known Member Licensed User Longtime User Aug 30, 2023 #3 Thanks but that doesn't sound like what I asked for. I just want to run the CaptureVideo sub Something like that B4X: Sub Activity_KeyPress (KeyCode As Int) As Boolean If KeyCode=24 Then Log ("CAPTURE VIDEO") CallSubDelayed(B4XMainPage,"CaptureVideo") End If End Sub Upvote 0
Thanks but that doesn't sound like what I asked for. I just want to run the CaptureVideo sub Something like that B4X: Sub Activity_KeyPress (KeyCode As Int) As Boolean If KeyCode=24 Then Log ("CAPTURE VIDEO") CallSubDelayed(B4XMainPage,"CaptureVideo") End If End Sub
udg Expert Licensed User Longtime User Aug 30, 2023 #4 Hi @AlpVir , did you try @klaus suggestion? You should modify the Activity_KeyPress sub in Main as showed by Erel in his solution. Then add sub B4XPage_KeyPress in your B4xMainPage, test keycode for the value you need (24) and run the sub you indicated (CaptureVideos) This scheme has the benefit of giving any B4xPage the ability to run that sub (provided that page has a proper B4XPage_KeyPress sub) Note by Erel: And implement B4XPage_KeyPress in the relevant pages. The back key will be handled in the CloseRequest event sub. Upvote 0
Hi @AlpVir , did you try @klaus suggestion? You should modify the Activity_KeyPress sub in Main as showed by Erel in his solution. Then add sub B4XPage_KeyPress in your B4xMainPage, test keycode for the value you need (24) and run the sub you indicated (CaptureVideos) This scheme has the benefit of giving any B4xPage the ability to run that sub (provided that page has a proper B4XPage_KeyPress sub) Note by Erel: And implement B4XPage_KeyPress in the relevant pages. The back key will be handled in the CloseRequest event sub.
AlpVir Well-Known Member Licensed User Longtime User Aug 30, 2023 #5 @udg Thanks I didn't realize that I also had to make the sub B4Xpage_KeyPress (KeyCode As Int) As Boolean Upvote 0
@udg Thanks I didn't realize that I also had to make the sub B4Xpage_KeyPress (KeyCode As Int) As Boolean
LucaMs Expert Licensed User Longtime User Aug 31, 2023 #6 AlpVir said: CallSubDelayed(B4XMainPage,"CaptureVideo") Click to expand... CallSubDelayed(B4XPages.MainPage, "CaptureVideo") Upvote 0
AlpVir said: CallSubDelayed(B4XMainPage,"CaptureVideo") Click to expand... CallSubDelayed(B4XPages.MainPage, "CaptureVideo")