Anyone with Success using CustomDialogs in Classes?

NFOBoy

Active Member
Licensed User
Longtime User
I am working on a Library to make multi-language preference menus.


In my Library, is a class for picking a color choice.

I would like to have the same functionality as the Dialogs' Library ColorDialog, but usable on phones in landscape mode.

When I use the ColorDialog.Show in Portrait Mode, it works exactly like I would expect.

I then make a panel with three SeekBars in landscape mode similiar to the Dialogs ColorDialog. But I cannot get the ValueChanged events to process.

If I add the Panel straight to the activity, the events process as expected.

I CAN add the Panel and get the functionality I expect, but then it is non-modal... and it would not match what I think the user (nor myself) expect, which is that timers stop, the background dims.. etc, etc.

I have looked at this thread http://www.b4x.com/forum/basic4android-updates-questions/18839-customdialog-events-2.html and my code is not being called in Activity Create.

When I check the unfiltered logs, I see for CustomDialog:

Touch event's action is 0x0 (deviceType=0) [pCnt=1, s=0.1223 ]
Delivering touch to current input target: action: 0x0
Delivering touch to current input target: action: 0x0
Delivering touch to current input target: action: 0x0
mIsLockZone = true mTiltAngle : 54.18245 value : 20
Touch event's action is 0x1 (deviceType=0) [pCnt=1, s=]
Delivering touch to current input target: action: 0x1
Delivering touch to current input target: action: 0x1
Delivering touch to current input target: action: 0x1


When I put the panel in non-modal I get:

Touch event's action is 0x0 (deviceType=0) [pCnt=1, s=0.1231 ]
Delivering touch to current input target: action: 0x0
Delivering touch to current input target: action: 0x0
Delivering touch to current input target: action: 0x0
Touch event's action is 0x1 (deviceType=0) [pCnt=1, s=]
Delivering touch to current input target: action: 0x1
Delivering touch to current input target: action: 0x1
Delivering touch to current input target: action: 0x1

So it appears that the events should be firing, but are not.

Yet the ColorDialog works great... so somehow it continues to fire events, but I can't grab those events in my Class Code.

????
 

NFOBoy

Active Member
Licensed User
Longtime User
Erel,

ok.. no more banging head there. But, then how does the ColorDialog continue to receive events and process them? (or any of the Modal Dialogs that do more than just OK, No, Cancel?)

Ross

(And my follow up, is there a way to build a modal dialog class? Or only if you go the route that Andrew did when developing the library? )
 
Last edited:
Upvote 0

agraham

Expert
Licensed User
Longtime User
Erel is referring to Basic4android events. In the ColorDialog, and others, there are no Basic4android events but there are various listeners set for the individual controls on the dialog so they can interact. The Basic4android modal mechanism pumps the message queue allowing GUI related messsages to pass but stalling some others, including Basic4android events, that cause problems.

I'm not really aware of the all the ins and outs of the way modal dialogs work but they are synthesised by Basic4android as Android itself has no modal dialogs. I used to understand it in the early days but as Android has evolved it has broken the modal mechanism on several occasions and Erel has had to fix it up so it's pretty complicated now
 
Upvote 0

NFOBoy

Active Member
Licensed User
Longtime User
Ahhh, got it. By the way, love your libraries (as many others here).

That is a shame, as there are some wonderful jumping off points for some Classes using the Modal Dialogs, especialy the CustomDialog!

If I may, what is the mechanism to Dim the entire rest of the screen? I don't see how to put a panel over the "entire" screen, so that I can at least simulate that part of the Modal Dialogs.
 
Upvote 0

NFOBoy

Active Member
Licensed User
Longtime User
Erel, thanks... I am looking to get it over the whole screen, including notification and title bar!
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…