B4A Library [Class] Floating Windows

Hello,

With this class, you can create floating windows, move them with the finger, dock them, stick them to an edge, maximize them, customize their action bar... You fill them as you fill a panel.

This class needs the Reflection library.

img1.jpg puzzle.png

v1.1:
The class has been splitted in two: ClsFloatingWindow and ClsActionBar.
This version includes a lot of changes.

v1.2:
Fixed bugs
Added a resize button
Added new functions and parameters
Added animations for docking areas and sticky edges
Changed the parameters returned by the custom buttons so as to be consistent with the ready-made buttons
Improved management of overlapping special areas
Improved the formula used to detect a move

v1.21:
Fixed a conflict between StillVisible and the special areas

v1.22:
Fixed two bugs in CheckSpecialAreas (thanks to Awama)

v1.23:
Fixed five bugs (yes, five... :()

v1.24:
Updated the ActionBar class required by this class.

v1.25:
Fixed a bug in the computation of covered areas while docking a window;
Updated the ActionBar class required by this class;
No more warnings with B4A v2.7.

v1.26:
Updated the ActionBar class required by this class.

Fred
 

Attachments

  • FloatingWindows v1.26.zip
    32.6 KB · Views: 1,719
Last edited:

tamayo461

Member
Licensed User
Longtime User
Genial!!!

Un Excelente trabajo amigo, gracias por compartir.

...Saludos desde Colombia.
 

peacemaker

Expert
Licensed User
Longtime User
Is it only floating children within the activity ?
No possibility to make a windows that is always floating over any activity, system one ?
 

EduardoElias

Well-Known Member
Licensed User
Longtime User
Informatix:

First of all: You work is excelent. I am using your library in so many different ways that I am impressed.

Right now I am using it to simulate the Windows 8 Tile menu style. It is fantastic. Of course there are some effects that it is not doing same way, but I am not looking for a exact match. Just the concept.

Well, but there is a problem that I need to solve.

I am using that adddockingarea and adding many rects for the tile positions. For a tablet is will renders a grid with 3 by 3 rects. And double of that for the small tiles.

What is happening is that when touching the floatingwindow and dragging it move, SOMETIMES, it moves like a heavy object (i have no idea how to better explain that), it does not move freely how it should be.

The common behavior is that when moving out of the dockingarea it changes the color of the current docking area and when getting on the next docking area, this new area changes the color. If i release the window it moves to fit the docking area correctly.

This bug happens always when you try to move the window out of the docking area. And if you release the window it does not move automatically to any docking area. Actually should go back where it was, since the problem happens with most of the window area yet inside the docking area.

The docking areas do not override. There is no events attached to the floating window.

Any help would be appreciated.

Eduardo
 

EduardoElias

Well-Known Member
Licensed User
Longtime User
Are you sure there's no sticky edge defined ?

An example would help to understand. Since you're doing something very close to my second demo, you could modify this demo to show me what's wrong.

Thanks for your interest in my work.

Yes, I have based on the concept of your second demo. However the docking areas are larger and more closer of each other.

I dont have a sticky edge, i double checked that.

I made a library with then new "compile to library" method, however i would like to send the source code direct to you, if you dont mind, because it is hard to remove from the source code this part only to create the example, and I really appreciate you taking a look, and even giving a comment on that. Let me know how to send you directly.

Thanks !!!!

Eduardo
 

EduardoElias

Well-Known Member
Licensed User
Longtime User
I have the following problem:

Considering the example 2 of floating windows as starting point, where there is a grid of 2 x 3 docking areas (panels). However using 2 floating windows instead of one.

What I want to know is how to find out that one floating windows is already docked when the user is draging another floating window to the same docking area.

If the user is draging the window to that position probably he is expecting that the previous windows gets out of that position. What is fine, once I know which is the floating window that I need to move to open the docking area for the new one.

I am somewhat lost trying to do that.

Any clue on that?

Many Thanks,

Regards,

Eduardo Elias
 

EduardoElias

Well-Known Member
Licensed User
Longtime User
This class is really a nice work, it is helping me in many different ways. Many thanks for sharing it. The fruits will come!

I have question:

there is a strange behavior happening, I am using this class like the second demo. When I start moving the tile, it is undocked fine, and start moving, everytime showing the possible new dock location fine.

However the floating window start to shake, it is not smooth moving. I have removed the dock/undock/move code events to see how it interferre, and nothing changed.

Some times if I move and stop moving without releasing the finger it start shaking so aggressively :) with angry, all over the place, but if I keep moving again it comes back to its place shaking less.

My question is: have you had such behavior before? I believe there is interference from something else, but I have not idea where to dig that.

Regards,

Eduardo Elias

EDIT: PLEASE,l I wanted to ask another thing, how can I get a "click" event using a floating window? I am trying to use a mixture of the OnDock/OnMove/OnUndock events to get a simulated OnClick (the entire floating window acting as a button). When docked I want to act like a button.
 
Last edited:

Informatix

Expert
Licensed User
Longtime User
...
However the floating window start to shake, it is not smooth moving. I have removed the dock/undock/move code events to see how it interferre, and nothing changed.

Some times if I move and stop moving without releasing the finger it start shaking so aggressively :) with angry, all over the place, but if I keep moving again it comes back to its place shaking less.

My question is: have you had such behavior before? I believe there is interference from something else, but I have not idea where to dig that.

I never saw that so I have no clue.

...
PLEASE,l I wanted to ask another thing, how can I get a "click" event using a floating window? I am trying to use a mixture of the OnDock/OnMove/OnUndock events to get a simulated OnClick (the entire floating window acting as a button). When docked I want to act like a button.
The floating window is a panel reacting to the touch events. If you want to catch the click events, you have to ignore the touch events once docked (the onTouch handler must return false). An easier way is to detect if the window has moved when Action = 1. If the window is docked and didn't move, then the user action is a click.
 
Last edited:

deantangNYP

Active Member
Licensed User
Longtime User
Hi, May i know if its possible include a "Minimize" button - only Displaying the Title Bar when minimized ?
Please Advise.
Thanks in advance..

Effectivement. I should rename MinMaxButton to MaximizeButton.
Instead of creating a lot of buttons (I have personally no need for a MinimizeButton and I hardly see what it should do), I'm going to add a function allowing to add your own buttons. And to avoid an action bar looking like a Christmas tree, I'm going to standardize it.
 
Last edited:

NFOBoy

Active Member
Licensed User
Longtime User
Frederic,

if I understand this class correctly, if we could somehow set the View to have the flag TYPE_SYSTEM_ALERT set, then these could be used as floating apps?

Ross
 
Top