Android Question help needed - how to disable a panel and its elements

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
i have a view (panel) in B4A app
i display another panel ontop
the top panel is partly transparent so the under panel is visible
how can i grab the under panel's name to identify it (it can be one of many in my app)
and then disable it and after i am done to re-enable it?
otherwise the user can still click any button in the background pannel
i want only the top one to be active
in windows i can show a modal form or topmost form - how can i do it in b4a?
thanks
 

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
wow, thanks Ilan!
i will look into it ASAP
Happy new Year...
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
sorry i'm afraid we have a misunderstanding
did you see the remarks i left in the code?

if i use the form method there is no issue of returning to the same place
the issue is now to control the keypress on the under form as it is alive and will fire the the click on each time i press it
i solved it with the check if the view is visible but not sure it's the right way

secondly - i don't have the ability to get the key pressed as the flow goes on and the calling code loses control
i mentioned within the sample code where i need to be so i can grab the response and move on
in the sample you sent this is unhandled so yes the view is shown but the calling code had gone to the next line without waiting for my click so i cant know what the user pressed and take action accordingly

thnks...
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
are you using the same project i sent you?
there are no clicks triggered when you show the dialog. i added a panel that will catch all click and tested it.
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
I think I do
I did download the attached zip, I saw my comments are gone

Any way I will download and try again and hope that I will have to apologize...
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
I think I do
I did download the attached zip, I saw my comments are gone

Any way I will download and try again and hope that I will have to apologize...

do you see lines that has this comment

do you have in the zDialog layout a Panel named: tpnl ??
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
do you see lines that has this comment


do you have in the zDialog layout a Panel named: tpnl ??
checked and rechecked - i got the right zip
y have the <<<<<<<<<<<< signs
no extra panel but there is a tpnl_click empy rourine (no other mentiones or use of this panel)
so maybe i got something not fully updated?

and there is the issue of clicking the buttons that is not functinal as i need

thanks for your support...
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
Last edited:
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
What do you mean no extra panel in the layout file you dont see the tpnl?

View attachment 146433



That's the whole idea. Like this the panel catches the presses instead of underlined views
No Ilan this panel is missing
So, Could you repack and upload?
Or if you prefer send it directly or she or whatever you choose
I promise to check it today and revert

Thanks
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
What do you mean no extra panel in the layout file you dont see the tpnl?

View attachment 146433



That's the whole idea. Like this the panel catches the presses instead of underlined views
ok, i have downloaded again
now it has the panel...
however - the clicks of the under view are active
yes - the trick of checking if the view is visible is active but they are stil operative
this may be a problem if the under view has a button that does another task like open another view - that will be fired on top of the zDialog view

look here

If pnlDialog.Visible=True Then
Return <---- this is fired upon each click on any of the under view
End If


another issue is the original one - it doesn't act like a dialog so click the ok or no or gotit will not produce the return as needed

i getting desperate on this challenge...
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
No Ilan this panel is missing
So, Could you repack and upload?
Or if you prefer send it directly or she or whatever you choose
I promise to check it today and revert

Thanks
i have just downloaded the zip and it is not missing.
Clearly there is a misunderstanding here.

if you open the layout zDialog.bal you will see a panel in the background named "tpnl". there reason for that is to catch all presses that or outside the button in that layout. so no views below that panel can catch presses. this will solve the problem you described.

then in the code you will see that i store a value inside a map when you call zShowConfirm or Button2_Click and i reset it when you close the dialog so if the app was closed before the dialog was closed you will have that value inside the map and you can then start again from the dialog in any stat you like.

note that you will need to implement the stat by yourself because i cannot know what you are doing in your app. this is just to give you a direction.
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
this cannot be true if you are not missing the correct event.
i took the sample you corrected
run it and then just click on one of the buttons on the under view
the click was active and fired the zDialog view
yes - the test if it is visible and then return did the job but if the button was to fire another task it would go and fire it
just check with debug on the return command and you'll see that it is being stopped there

if i need to do anything in addition please just tell me
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
i think that the main issue is that i can't have a modal form like i can i visual studio for example
so i can open a new form that will be declared as modal and will block any action on the under forms and also stop and wait in the calling form to the modal form to close
this way i could handle the confirm window and its buttons with a return value and then the flow of the under view will continue
currently the zDialog is being displayed but the calling view's flow keep running without waiting so the entire idea of using this "trick" as alternative dialog can't really work
once again - i think...
 
Upvote 0

ilan

Expert
Licensed User
Longtime User

* i removed tpnl from the layout
* added event name to pnlDialog "pnlDialog"
* changed the click event to this name

B4X:
Private Sub pnlDialog_Click  '<<<<<<
    'dont do anything just filter all clicks
End Sub

because you load the layout to a panel you need to catch the presses on that panel
try the example below it should work
 

Attachments

  • zDialogv3.zip
    5.5 KB · Views: 101
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User

hi, thanks
that did the job of preventing under view's click - perfect

however - the main issue remains - where i can't control the buttons click and return the value to the under (calling) view as it fired the load view and movged on without waiting
so if i could just either hold it waiting until the zDialog is gone and then i have the button pressed or do something like wait... that could solve the problem

BTW - there is no need for the map any more as when the app is being interrupted the current view is not gone as a regular dialog
it stays on the screen (perfect!) so i get back to the the same view i was in

the only problem is how to hold the flow until the zDialog is done or one of its buttons was clicked so i can return the value i want to the calling view

if i can't do that the entire solution will not work for me as i need a replacement for a dialog

once again many thanks for your help
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
so if i could just either hold it waiting until the zDialog is gone and then i have the button pressed or do something like wait... that could solve the problem
i dont understand what you mean. as long as the zDialog is on top you have to close it before you can continue with other options in the app.

BTW - there is no need for the map any more as when the app is being interrupted the current view is not gone as a regular dialog
it stays on the screen (perfect!) so i get back to the the same view i was in
from what you are writing here i can see that you didnot understood my point.

lets say you let your users fill a form of 3 pages and in page 2 he got an incoming call now when he return to the app the flow is gone and now he need to restart again to fill that form. this is what i understood is your issue and i gave you a solution, you save the stats of the textfield and everything else inside a map and when you return you fill again the values to the form and continue the flow. the correct handling is needed to be done by you since i cannot code for you the solution as i dont know what exactly you are doing in your app. as i said before i just can give you a direction (solution) not a full snippet where you copy paste to your app and everything is working perfect.
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
thanks, but that is not an option
the code of the app is huge
it is a live app with many active users
the flow is very complex so i cannot do that
i found that dialogs are disapearing if the app is interrupted for example by a call and when resume the dialog is gone
so i need either a dialog replacement that will keep on the screen when resuming (aview/panel does it perfectly but i have no control of the flow to wait until the dialog "view" is done so the flow is gone)
or a simple dialog replacement to do that
i use dialogs for displaying system messages and to get confirmation (message and yes / no options) user's response and upon that take the route in code
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
as you could see from the sample i do close it
but i have no wau to return the answer to the calling view as it fired the zDialog and moved on - not like a modal dialog or wait or modal form in visual studio for example

as per interrupt - when resuming the app is exactly where it was so this is now resolved with the view zdialog
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
Now (today?) I really don't feel to read all 35 posts. I assume that the topic has been changed (and in this case a new thread should have been created), since the first answer is the correct one.
sorry
the topic is the same as the list of Q & A evolved
i think it is a complex topic - hence we're still on it
either proposed solution did solve one part of the issue and left another open
so i'm trying to get a solution to close both issues i got from the dialog issue i have
once again sorry if you found this to long
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…