Is this possible in B4A?

TrisectDevelopment

Active Member
Licensed User
Longtime User
I have made an iPhone App where the user touch the screen and a menu appear.
You then move you finger to the desired menu and let go.

Like this.
menu.png


Is this possible in Basic4Android?
 

Djembefola

Active Member
Licensed User
Longtime User
You can easily program this in b4a with a transparent panel, the canvas object and the .drawbitmap function. All you need is a background bitmap with transparent borders and several bitmaps for the 'clicked' and 'selected' button state.

hit-testing in the touch event will be a little bit tricky because of the non-rectangular button-regions.
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
Very nice and useful example. Thanks!

By the way, you have written a real nice blog. Have you published the AI-library?

I made a little tutorial with an example on the detection of pixel precise mouse/touch events in irregular shapes. You can find it on my blog: Alwaysbusy's Corner
 
Upvote 0

hdtvirl

Active Member
Licensed User
Longtime User
Can you post your The Basic4Android example on this site.

Alwaysbusy, can you post your "Detecting pixel precise click/touch in irregular shapes" demo app on this site also please.

It looks like a great example thank you.

Regards

BOB
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
@moster67: Do you mean the Augmented Reality lib? Not yet, it's still very experimental. I'm looking into various possibilities before releasing it.

@thedesolatesoul: yes, it is sort of a trade-off. On PC it is no problem at all and a huge speed advantage. On android, I still have to do some more tests but it looks promising.
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
@thedesolatesoul: yes, it is sort of a trade-off. On PC it is no problem at all and a huge speed advantage. On android, I still have to do some more tests but it looks promising.
Well if a 1024x768 bitmap is only taking 3MB out of 1GB RAM available on most devices, then why worry! (Loading the bitmap will take a while but thats about it)
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
Yes, you are right. :sign0013: I mixed things up. I meant of course the Augmented Reality library. Sorry.

If you decide to share the library when you feel it is ready, I am sure it will be very useful and appreciated by users here on the forum, just like your other great libraries.

Sorry for the off-topic.

@moster67: Do you mean the Augmented Reality lib? Not yet, it's still very experimental. I'm looking into various possibilities before releasing it.
 
Upvote 0

TrisectDevelopment

Active Member
Licensed User
Longtime User
#alwaysbusy

I tried you sample code but it does now work correctly on my LG Optimus One.
:confused:

And it does not work correctly in the emulator.

It does not return the right menu.
 
Upvote 0

hdtvirl

Active Member
Licensed User
Longtime User
It did not work for me neither.

Alwaysbusy, I tried your example on the Acer Iconia Tab and it did not work neither and the response to a screen touch was very sloooooow.

Thanks anyway for sharing this with us.


Regards

BOB
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
Are you using a different screen resolution than 480x800? Because if you do, it will not work.

If for example you have 240x320, then when you touch in the middle, you get x = 120 and y = 160 but in the map picture, this position is not the correct menu item (the middle is x = 240, Y = 400). You'll need to change the code to make it work for other resolutions.

@hdtvirl. GetPixel() is not the fastest way to get a pixel color. I'm sure other ways in java can get te value faster (like with the getPixels() function to a byte array, However, I' m a little suprised it is so slow. On my Galaxy S I get the selection realtime.

My guess is maybe because the label is on the panel, every time it changes the label text it also refreshes the whole picture. (which can be very slow if your resolution is other then 480x800 because it needs to resize the whole pic all the time). Try experimenting with a different layout.
 
Upvote 0

hdtvirl

Active Member
Licensed User
Longtime User
You are probably correct.

Alwaysbusy you probably are correct about the resolution, I did not look to hard at the code and I was only giving you feedback on my experience with the tutorial.

The example you did in RealBasic, would it be possible to port it to B4A also or is that too a BitMap image ?.

Anyway thanks for your example it gives us a good idea of how to solve the problem.

Anyway back to coding, I am trying do implement an encryption routine from VB.Net which I use and I am tripping up on a few of B4A Nuances, my head is still full of DotNet.

Regards

BOB

P.S I don't think the German Weiss Bier is helping, but it is Friday night afterall !!!
 
Upvote 0
Top