B4A Library [Class] Floating Windows

Informatix

Expert
Licensed User
Longtime User
After_Undock is an event raised when you leave a dock area. At this moment, the finger is on the screen, moving the window. It's normal that you get an error if you try to close the window. You have to wait until the finger is up. You can also modify the class to cancel the touch event. But what do you want to do exactly because I cannot see why you want to close a window while undocking?
 

winjiadh

Active Member
Licensed User
Longtime User
hank you for your reply
I made a sample, including AddWin added a process
Want to do after this win into the dock, the bottom of the screen to create a win
B4X:
Sub AddWin
    Dim Win As ClsFloatingWindow
    Win.Initialize(Activity, 0, 0, 120dip, 90dip, Me)
    Win.SetTitleText("Drag me")
    Win.StillVisible = 90dip
    Win.TouchSlop = 0 'The window will start to move immediately after a finger move
    SetBackimg
    ' Docking areas and sticky edge
    Dim wRect As Rect, Left, Top, p As Int
    wRect.Initialize(Left, Top, Left + 110dip, Top + 110dip)
    Win.AddDockingArea(wRect)
    Win.Move(100dip, 100%y - 90dip, True)
    Win.AddStickyEdge(3, 100%y)
    Win.SetOnStickListener("After_Stick")
    Win.SetOnEnterDockAreaListener("Entering_DockA")
    Win.SetOnDockListener("After_Dock")
    Win.SetOnUndockListener("After_Undock")
End Sub
I'm ready, but the problem is here
This win is the more the more, so I hope when win removed from the dock, closed out the win
Hope to get your help, I how to define when finger is up, closed out the win?
 

Informatix

Expert
Licensed User
Longtime User
hank you for your reply
I made a sample, including AddWin added a process
Could you post this sample ?
I'm sorry but I don't have a clear understanding of your intent (and the automatic translator that you use does not help). Maybe a practical example could help me to understand.
 

winjiadh

Active Member
Licensed User
Longtime User
thanks
I upload the new files to you ,but the filles on error when I close the win.
I need you help
when win removed from the dock, closed the win
 

Attachments

  • newFloatWinDemo2.zip
    19.6 KB · Views: 202

Informatix

Expert
Licensed User
Longtime User
thanks
I upload the new files to you ,but the filles on error when I close the win.
I need you help
when win removed from the dock, closed the win
You uploaded my own demo! Without further explanations or a demo more explicit (what's your app intended for? why the user should do this?), I cannot help. Closing the window while undocking is extremely simple: Win.Close in After_Undock and Return just after CallSub2(wModule, OnUndockWinSub, Me) in the class (or replace CallSub2... by Close and Return), so I don't think that is what you're really asking.
 

ttsolution

Member
Licensed User
Longtime User
Hi all,

I added some small adjust to the class for modal window.

Jonh,
 

Attachments

  • ClsFloatingWindow.bas
    31.4 KB · Views: 189

Informatix

Expert
Licensed User
Longtime User
Hi all,

I added some small adjust to the class for modal window.

Jonh,
Technically, what you did is a blocking window, not a modal window (you don't stop the code execution while the window is displayed).
As you deactivated the MoveWin function so the window cannot move, what's the reason to use this class? There are better alternatives to display a modal dialog, e.g. my BetterDialogs library. I'm curious to know the reason.
 

ttsolution

Member
Licensed User
Longtime User
Hi all,

Using the BetterDialog Lib. How can we trap the PositiveButton Click Event ? I need to check user input before close the dialog

Many thanks,

Jonh.
 

billmoultrie

Member
Licensed User
Longtime User
I am using Informatix's puzzle version of his demo (the 9 square matrix).
I am trying to slide a tile from its original position to the adjacent tile and get them to swap their position.
This means I have to detect the movement of the tile, which I can with UnDock.
But I can not see how to swap the stickyedge addresses so that when the animation begins they will change places.

Can anyone help.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…