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,344
Last edited:

moster67

Expert
Licensed User
Longtime User
Incredible and Amazing :icon_clap:

Work of a genius. Respect!

Thanks for sharing.
 

Informatix

Expert
Licensed User
Longtime User
Ok, let's talk about price.

... I'm joking. :)

I try to use my own creation in a real app and it appears some features are missing (events for docking/sticking, pinning button). I think the action bar could be nicer and events declaration should be different. So there will be a new version before the end of the coming week. If you have ideas, let me know.

As you can see in demo #1, I use a ListView in one of the windows. In fact, I don't recommend to use any scrollable container in a floating window. You should avoid ListViews, ScrollViews, ViewPagers... It's difficult to handle them properly and their behavior could be unexpected under certain circumstances (I could show you a few issues with the ListView in demo #1). If you want to display a short list, you can use labels and radio buttons instead of a Listview. If you absolutely need a ListView and want to scroll its content, add the view with DelegateTouchEvent = false. The window won't intercept the Touch events, so the ListView will be perfectly handled. Drawback: you won't be able to move the window while your finger is on the ListView.
 

Mahares

Expert
Licensed User
Longtime User
C'est magnifique Fred! Let me add that you need B4a vesion 2.02 to run the demos. Otherwise, you will get an error.
 

bparent

Member
Licensed User
Longtime User
V2.02

C'est magnifique Fred! Let me add that you need B4a vesion 2.02 to run the demos. Otherwise, you will get an error.

Erel or others , where do we get V2.02? Was there an updrade download email sent? Under Help->About my verion shows 2.00.

Thanks.
 

barx

Well-Known Member
Licensed User
Longtime User
Erel or others , where do we get V2.02? Was there an updrade download email sent? Under Help->About my verion shows 2.00.

Thanks.

I believe you use the same link and password details as v2.00
 

Mahares

Expert
Licensed User
Longtime User
B4X:
W(3).EnableMinMaxButton(True, "ResizeWin")
The MinMaxButton is actually a MaxRestore button from what I gathered. Is it prudent to have an actual MINIMIZE button or is it a matter of resizing the window?
 

Informatix

Expert
Licensed User
Longtime User
B4X:
W(3).EnableMinMaxButton(True, "ResizeWin")
The MinMaxButton is actually a MaxRestore button from what I gathered. Is it prudent to have an actual MINIMIZE button or is it a matter of resizing the window?

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.
 

Djembefola

Active Member
Licensed User
Longtime User
Informatix, it's a pleasure to read (and learn from) your code!

What i would like to have in the next version:

A Show and a Hide Method (as a workaround for a .visible Property)
 

Mahares

Expert
Licensed User
Longtime User
@Fred: In the current version, once you close a WINDOW you cannot get it back unless you restart the app. I did not see a method that allows you to get it back?
Thank you for your creativity.
 

Informatix

Expert
Licensed User
Longtime User
@Fred: In the current version, once you close a WINDOW you cannot get it back unless you restart the app. I did not see a method that allows you to get it back?
Thank you for your creativity.

Closing a window means destroying it. If you want to re-open it, you have to recreate it. I suppose you want something like a show/hide method. That will be added.
 
Top