Floating Moveable Window

ItWorks

Member
Licensed User
Longtime User
Hi Guys,

Moveable Window example for you to consider
I'm new to B4A but I am slowly getting to grips with it.
I am porting a VB app onto Android and needed a Floating Window.
So here is an example of how I solved it.
EnJoy
 

Attachments

  • FloatingWindow.zip
    2.5 KB · Views: 274

ItWorks

Member
Licensed User
Longtime User
Floating Window

Hi

No I didn't, I just exported the relevant items, just extract it and put the file in the files folder of a new project and use the source code in your project.

I can upload all the superflouous information if that is what people want but is not really neccessary.

Regards
 
Upvote 0

ItWorks

Member
Licensed User
Longtime User
Floating Window Example

Hi Guys,

Improved version for you to consider, smoother movement and resolution choice.

Regards
 

Attachments

  • FloatingWindowExample.zip
    7.6 KB · Views: 267
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Nice work ITWorks. One little observation: Once you can slide the floater off the screen you cannot get it back. It disappears.
 
Upvote 0

ItWorks

Member
Licensed User
Longtime User
Floating Window

Hi Maheres,

Easily solved by adding a test for max screen limits and not allowing it off the screen.

try:-
If Pos < 0 Of Pos > "whatever your screen size is here in pixels" - 40 then
etc etc

The 40 pixels will ensure you cannot push it more then 40 pixels less than the screen. If you do it will jump to zero in the axis you are currently testing.

I'll post a full edge checking routine later.

Regards
 
Upvote 0

ItWorks

Member
Licensed User
Longtime User
Floating Window Example

Hi Guys,

Here is an updated version to stop the window being pushed off screen.

Enjoy
 

Attachments

  • FloatingWindowVersion1_2.zip
    7.9 KB · Views: 308
Upvote 0

ItWorks

Member
Licensed User
Longtime User
Moveable Window

Hi vb1992,

I am developing on a tablet with a Resistive touch screen so it requires pressure to define the X & Y coordinates, I supect that on a Capacitive screen that the X & Y jitters because a persons finger (or stylus) is only a few pico farads (which will vary with angle and pressure), and that the resolution of the XY point may move even if you simply hold your finger completely still. You could try increasing the resolution figure to a higher number, before you allow the screen to reposition itself.

I could improve the routine further with buffered XY points and average over a time period, but for my use it is adequate because on a Resistive screen it is relatively smooth and that is what I am developing the software for.

But thanks for the heads up on the linked code, it looks an interesting solution.

Regards
 
Upvote 0
Top