B4J Question How to prevent a modal form to appear in the taskbar?

Cableguy

Expert
Licensed User
Longtime User
Hi guys,

I thought that, a Modal form, since it blocks current code, that it would not show in the taskbar, as if it was a no-modal form...
How can I prevent the modal-form from showing in the task bar?
 

Daestrum

Expert
Licensed User
Longtime User
If you had a modal form without a close button and your codes goes wonky, how would the user close it, at least if it's in the taskbar they can right click close it.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
I do provide a way to close the modal form, so I only need to prevent it from showing in the task bar
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Thats a problem since I wish to use style transparent! Any other way?
 
Upvote 0

jmon

Well-Known Member
Licensed User
Longtime User
Did you set "MainForm.SetOwner()"?
B4X:
Public Sub Initialize(Owner As Form)
    MainForm.Initialize("MainForm", 200, 200)
    MainForm.SetOwner(Owner)
    MainForm.BackColor = fx.Colors.Transparent
    MainForm.SetFormStyle("TRANSPARENT")
    MainForm.RootPane.Style = $"-fx-background-color:red;-fx-background-radius:48px;"$
    MainForm.RootPane.MouseCursor = fx.Cursors.HAND

    Dim btn As Button
    btn.Initialize("btn")
    btn.Text = $"Close modal form"$
    MainForm.RootPane.AddNode(btn, 25, 25, -1, -1)

    MainForm.ShowAndWait  
End Sub

in the example that I provide it works with a transparent window, and doesn't show up in the taskbar.

I also provided the code to make the window draggable.
 

Attachments

  • ModalFormExample.zip
    1.9 KB · Views: 275
Upvote 0
Top